Template:Urltowiki/doc

This template takes a wiki URL and outputs the equivalent wikilink, with optional display text. It is useful for quickly creating properly formatted wikilinks to talk page sections or external wikis. It accepts URLs from most Wikimedia wikis. The template should usually be substituted, but will work with transclusion as well.

If given a partial URL (without the protocol and the host name) the template will remove any underlines and decode percent-encoded characters. If given a valid URL that is not recognised as a Wikimedia wiki, it will output the URL unlinked. See below for how to add new wikis.

The shortcut is available.

A similar URL-to-wikitext transformation can be done directly in the edit window using the User:Js/urldecoder user script.

Usage

 * Quick usage
 * CAUTION: This syntax will not work if the URL contains "=".


 * Basic usage
 * The following will work for all URLs.


 * All parameters

Parameters

 * url - the URL you wish to be converted into wikitext. This parameter is required. You can also use the first positional parameter for the URL, but this will not work if the URL contains an equals sign.
 * display - the text you would like to be displayed, if not the interwiki link itself. This is equivalent to the text that comes after the pipe in a piped link. You can also use the second positional parameter for the display text, but this will only work if the first positional parameter is also present. Therefore, if you use this for the display value there must be no equals sign in the URL.
 * link - if this is set to "no", the template will not link the interwiki link, and will not display the display text.
 * section - if this is set to "no", no section links will be produced.
 * colontrick - if this is set to "no" the template will not use the colon trick for files and category pages. Note that if no then the colon trick will not be used anyway - this is necessitated by a longstanding bug in Mediawiki.
 * error - if this is set to "no" the template will return nothing instead of producing error messages if there is missing or invalid input.

Known limitations
This template will not work correctly if the original section name contains anything that looks percent-encoded. This usually means a period followed by two characters that could be hexadecimal. For example, the code  produces. To work around this you can set no and no, and add the link and the proper section name yourself. However, bear in mind that the actual link will still work properly even if it is displayed incorrectly, so it is not necessary to use the workaround if you also set the display parameter.

Additionally, some Wikimedia sites may not be supported yet. If you come across a site that isn't supported, please consider adding it to Module:InterwikiTable, as then it will work for all users.