Template:Sec link auto/doc

This is the sec link auto template. It can be used to link to any wikimedia project while using the type of connection the user prefers. It is mostly meant to replace hardcoded external links to wikimedia projects such as " ", because these links don't change to reflect the user's preference, like the normal wikilink notation " " automatically does. If you want to use a link that forces all users to use a secure connection, then use sec link instead. For other secure link templates see the see also section below.

Usage
This templates takes one or more parameters:
 * The first is the prefix of the Wikimedia project you want to link to. For instance "wiktionary" or "wikt" for Wiktionary, and "de" for the German Wikipedia. This parameter must always be fed. For the complete list of prefixes see Special:SiteMatrix and.
 * The second parameter is the full pagename you want to link to, such as "User:Example" or "São Paulo". If this parameter is omitted then this template links to the main page of the project.
 * The third parameter is the text that will be visible as the link. If this parameter is omitted the link address is instead shown.
 * There is also a named parameter "lang=". This parameter is usually not used. It takes a language prefix such as "de" or "pt". This enables to link to for instance the German version of Wiktionary. If this parameter is omitted, then this template links to the same language on the other project as you are on here. So if on the English Wikipedia, and you link to Wiktionary, per default you get a link to the English Wiktionary.

To compare how the links on this page look and behave when using the secure server, follow this link:

And here's some examples:

In the above example we fed "lang=pt" before the other parameters. That is okay since named parameters don't interfere with the numbering of unnamed parameters.

Anchors and queries
This template can also handle anchors and query parameters. Like this:

When feeding query parameters you must manually change any spaces " " to plus signs " ". But feed anchors unchanged.

The padlock
When these links are seen from the secure server, then they all have a small padlock. That padlock is automatically added to all https links by the global CSS in all Wikimedia projects. This template does not suppress that, since it makes it clearer when it is a secure link.

But if you want to suppress the padlock, then there are two ways. Like this:

Using " " is easier for a single link. But when having many links then surrounding the whole area with " " can be more convenient.

Many templates such as the mboxes, navboxes and infoboxes use the "plainlinks" class since it also prevents the external link icon. Thus when this template is used inside such boxes it looses the padlock. Then you can turn on the padlock like this:

Note: You will only see a padlock in the above example if you from the secure server, since this template only makes secure links if you already are using the secure server.

Technical details
When you are connected to the secure server, then most local links in a project is automatically secure links. But hardcoded links and links to other projects are unfortunately not auto-changed to secure links. With this template you can work around that.

This template doesn't handle the "" prefix, since it already points to a secure server.

Some languages on Wikisource don't have their own language project, instead they are pages under the main "" address. For instance the Afrikaans main page on Wikisourse is not " ", but instead " ".

This template internally uses the sub-templates sec link/relative url and sec link/text. Those sub-templates are also used by its sister templates.