Template:Querylink/doc

This template is used to create an internal link with a query string component. This addresses a limitation of the current wiki software.

Template:Querylink/doc

This template is used to create an internal link with a query string component. This addresses a limitation of the current wiki software.

The link will go to the specified page (1) with the specified query string (qs, of the form qs=name=value&name2=value2), optionally labeled with the specified caption (2), which defaults to the specified page (1).

Example

{{Querylink|Special:Allpages|qs=namespace=1|See what people are talking about}}

Produces: See what people are talking about

Reason

The MediaWiki software does not support the use of a query string element of an URL as part of the internal wiki link 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 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 edit page, one might use the following wikitext: [https://en.wikipedia.org/w/index.php?title={{FULLPAGENAMEE}}&action=edit edit]. This would produce the following link: edit. However, the edit page is not really an external link, so the desired result would be edit, without the external link graphic.

Usage

Internal links with a query string URL component may be achieved through the use of this 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 edit page using the querylink template, the following wikitext markup was used:

{{Querylink|Template:Querylink/doc|qs=action=edit|edit}}
  1. The first parameter passed to the template should be the name of the internal page that you wish to link. In this case, Template:Querylink/doc.
  2. The second parameter is the query string used to display the desired view of the page. It has the form qs= followed by the name and value pairs of the query string of the form name=value&name2=value2. In this case, just one name and value pair is used: action=edit.
  3. The third parameter is optional. If included, the text of this parameter will be used as the display name for the link text in the article, similar to 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: edit.

In some cases you might prefer to produce a query string without a page name. For that, simply omit the first parameter:

{{Querylink||qs=oldid=10000|10,000th revision}}

This produces the link 10,000th revision, pointing to the location https://en.wikipedia.org/?oldid=10000

Limitations

The template normally does not work as a target for #REDIRECT in redirect pages. You can subst: it to achieve that: {{subst:querylink|...}}

See also

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.