Template:Link/doc

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages. As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.

This template is used to create an internal link. The template rewrites the link to link to the same language subpage of the target page as the language subpage of the source page, if existing. Otherwise fallback to the English version.

Important
See Help:Links for general usage instructions of this template on the wiki.

Parameters

Link to a page that can automatically point to a translated page if it exists

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Link1

Internal page link

Example
Kernel
Stringrequired
Sectionsection anchor

A section of an internal link with a preceding # to designate an anchor

Example
#Usage
Stringoptional
Alternate text2

Optional text to replace the page name; use for translations and other context

Example
Gentoo's Kernel information
Stringsuggested

Rationale

On translated pages there is the following problem with internal links. E.g. to link the article "Foo" and the translation of "Foo" doesn't exists right now, the two possibilities are:

  • link the English page of "Foo".
Pro: Link to an available guide.
Contra: Later, when "Foo" gets translated, the reader is sent to an English page. There they have to select their language again. To save the reader from this hassle, all links to "Foo" in all translated pages have to be changed.
  • link the translated page of "Foo" (right now not existing).
Pro: Later, when "Foo" gets translated, the reader is sent to the translated page.
Contra: Until "Foo" gets translated, the link is pointing to an non-existing page. The readers has to get active, to even get to the English page.

This template solves this problem.

Usage

See the template's testcases:


Correct

One anonymous parameter (an internal link)
Wiki code
{{Link|Kernel}}
Main version
Sandbox version


Two anonymous parameters (an internal link and alternate text)
Wiki code
{{Link|Kernel|Gentoo's Kernel information}}
Main version
Sandbox version


Two anonymous parameters (an internal link and alternate text) and section
Wiki code
{{Link|Kernel|section=#Emerge|Gentoo's Kernel information}}
Main version
Sandbox version


One anonymous parameter (an internal link to untranslated page)
Wiki code
{{Link|Flac}}
Main version
Sandbox version


See also