Wikipedia:Internal query string links: Difference between revisions

Content deleted Content added
BBilge (talk | contribs)
Documentation for Template:Querylink
 
BBilge (talk | contribs)
Changed the example use of querylink from editing the talk page to just editing the page in order to eliminate confusion. Fixed various typos of the word "parameter". Damn butterfingers.
Line 1:
The [[MediaWiki]] software does not support the use of a '''[[query string]]''' [[URL]] element as part of the '''[[Help:Link#Wikilinks|internal link]]''' [[wikitext]] syntax. This means that when wishing to link to a page that requires a query string in order to display the desired view of a page, an [[Help:Link#External_links|external link]] must be used. This is misleading when linking to a page within the wiki itself. For example, to create a link to this page's talkedit page, one might use the following wikitext:
<code><nowiki>[http://en.wikipedia.org/w/index.php?title=Wikipedia_talk:</nowiki>{{PAGENAMEEFULLPAGENAMEE}}<nowiki>&action=edit talkedit]</nowiki></code>.
This would produce the following link:
[http://en.wikipedia.org/w/index.php?title=Wikipedia_talk:{{PAGENAMEEFULLPAGENAMEE}}&action=edit talkedit]. However, the talkedit page is not an external link, so the desired result would be {{Querylink|Wikipedia_talk:{{PAGENAMEEFULLPAGENAMEE}}|qs=action=edit|talkedit}}, without the external link graphic.
 
Internal links with a query string URL element may be achieved through the use of the [[Template:querylink|querylink]] template. This template has been provided as a [[workaround]] for the described wiki software limitation. The template has been designed to be usable in a similar manner to creating a normal internal link, and takes two to three parameters depending upon how you wish to use it. To create the example link from before to this page's talkedit page using the querylink template, the following wikitext markup was used:
<nowiki>{{Querylink|Wikipedia_talk:</nowiki>{{PAGENAMEEFULLPAGENAMEE}}<nowiki>|qs=action=edit|talkedit}}</nowiki>
 
All templates are called by enclosing the template name and parameters within a pair of curly braces "<code>{{}}</code>". All parameters are separated with the pipe character "<code>|</code>". The first "parameter" is always the ''name'' of the template that you wish to use and as such is not formally a parmaterparameter at all. In this case, it is <code>Querylink</code>.
 
#The first formal parameter passed to the template should be the name of the internal page that you wish to link. In this case, <code>Wikipedia_talk:{{PAGENAMEEFULLPAGENAMEE}}</code>
#The second paramaterparameter is the query string used to display the desired view of the page. It has the form <code>qs=</code> followed by the name and value pairs of the query string of the form <code>name=value&name2=value2</code>. In this case, just one name and value pair is used: <code>action=edit</code>.
#The third parameter is optional. If included, the text of this paramaterparameter will be used as the display name for the link text in the article, similar to [[Wikipedia:Piped_link|piped links]]. If omitted, the page name will be used instead, similar to ordinary internal links. In this case, we specify a friendly name for the link: <code>talkedit</code>.
 
==See also==