Help:Link: Difference between revisions

(Created page with "{{Help page}} '''Links''' are used to connect readers with other pages on the wiki or to other websites. Providing a link gives the reader one-click access to o...")
 
 
(One intermediate revision by the same user not shown)
Line 415:
The URL will begin with <code>http://</code> if the current page begins with <code>http://</code>, or <code>https://</code> if the current page begins with <code>https://</code>.<br />
This method of writing URLs is obsolete and should generally be avoided, as it will make no difference.
|<pre>[//www.example.com]</pre>
|[//www.example.com]
|-
|Protocol-relative URLs do not work if the URL is not surrounded by square brackets.
|<pre>//www.example.com</pre>
|//www.example.com
|}
Line 426:
It is not possible to create a regular wikilink to many dynamically generated pages on {{SITENAME}}. For example, <code>{{SERVERNAME}}/wiki/{{FULLPAGENAME}}?action=edit</code> cannot be linked to; attempting to write <code><nowiki>[[</nowiki>{{FULLPAGENAME}}?action=edit]]</code> will take you to the wrong page. This is because these URLs contain query parameters, like <code>?action=edit</code> and <code>&action=edit</code>. These contain the characters <code>?</code> and <code>&</code> which have special meanings in URLs. If you try to wikilink them, the software will automatically encode them into <code>%3F</code> and <code>%26</code> so that the link will take you to the page titles containing those characters, rather than to the edit window.
 
To link to pages with query parameters, for instance to create an "Edit" button that users can click on to edit the page, you will need to use external link syntax. For example, <code><nowiki>[https://</nowiki>{{SERVERNAME}}/wiki/{{FULLPAGENAME}}?action=edit Edit this page]</code> will work correctly.
 
If you are linking to a page within {{SITENAME}}, there is a better alternative: use the <code>fullurl</code> [[Help:Magic word|magic word]]. For example, <code><nowiki>[{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page]</nowiki></code> creates a link to edit the current page.