Jump to content

Help:Self link: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Indirect self links: Fixed indirect self link
Undid revision 1249411256 by 27.145.180.134 (talk) Must have been a mistake.
 
(35 intermediate revisions by 24 users not shown)
Line 1: Line 1:
{{about|pages that link to themselves|the guideline on articles referring to Wikipedia itself|Wikipedia:Manual of Style/Self-references to avoid#Writing about Wikipedia itself}}
{{Wikipedia how-to|WP:SELFLINK}}{{Linking and page manipulation|linking and diffs}}
{{Wikipedia how-to|WP:SELFLINK}}{{Linking and page manipulation|linking and diffs}}
A '''self link''' is a [[Help:link|link]] to the page on which the link appears. A self-link to a page appears as bold text when the article is viewed ("self-link feature"). Examples:
A '''self link''' is the use of a [[Help:link|link]] code with the page itself as target. It does not produce an actual link, but a non-clickable bold text (the "self-link format"). However, with the preference setting "Link underlining", this text is underlined. This can be suppressed putting the following in your relevant [[Help:Cascading_Style_Sheets#User-specific_style-sheets|personal css page]]:
<syntaxhighlight lang="css">.mw-selflink { text-decoration: none !important; }</syntaxhighlight>
*<nowiki>[[Help:Self link]]</nowiki> gives [[Help:Self link]]
*<nowiki>[[Help:Self link|piped self link]]</nowiki> gives [[Help:Self link|piped self link]]
A self-link to a section does not appear as bold text. Examples:
*<nowiki>[[#Self-link to a section|Self-link to a section]]</nowiki> gives [[#Self-link to a section|Self-link to a section]] (recommended)
*<nowiki>[[Help:Self link#Self-link to a section]]</nowiki> gives [[Help:Self link#Self-link to a section]] (not recommended)


Live examples (hence depending on your settings):
Self links are usually not recommended, except for:
*{{demo inline|<nowiki>[[Help:Self link]]</nowiki>}}
* Within text that is [[WP:transclusion|transcluded]] between several pages
*{{demo inline|<nowiki>[[Help:Self link]]s</nowiki>}}
* [[#Self-link to a section|Self-link to a section]], without the page name
*{{demo inline|<nowiki>[[Help:Self link|piped self link]]</nowiki>}}


Self links are usually undesirable, except for:
==Self-link to a section==
* Within [[Wikipedia:Navigation template|navigation templates]], where the self-link-produced boldface helps locate the article within the template
A link to a section of the same article, even from the same section, does not cause bold text and works as a normal link: [[Help:Self link#Self-link to a section]]. Such links should usually be written without the page name: [[#Self-link to a section]], because this method does not cause the page to reload (if the reader initially arrived at the page via a [[Wikipedia:Redirect|redirect]]) and is thus more efficient. A useful application is links from article leads or overview sections to detail sections buried deeper in the same article. An automatically generated [[WP:TOC|table of contents]] has links to sections on the page.
* Self-links to a section, [[#Self-link to a section|such as this link]], which links to the section below.

== Self-link to a section ==

A link to a section of the same article, even from the same section, does not produce bold text and works as a normal link. For example:

{{demo inline|<nowiki>[[Help:Self link#Self-link to a section]]</nowiki>}}

Such links should usually be written without the page name:

{{demo inline|<nowiki>[[#Self-link to a section]]</nowiki>}}

because this method does not cause the page to reload if the reader initially arrived at the page via a [[Wikipedia:Redirect|redirect]], and is thus more efficient. A useful application is links from article leads or overview sections to detail sections buried deeper in the same article. An automatically generated [[WP:TOC|table of contents]] has links to sections on the page.

== Suppression of self-links ==

In some cases, such as with templates that are ''not'' navigation templates, and that are [[WP:transclusion|transcluded]] into several pages, self-links can be actively suppressed by enclosing the link within the template {{tl|No self link}}.


==Indirect self links==
==Indirect self links==

An ''indirect'' self link is a link to a page that redirects back. In this case, the self-link feature does not work, even though the feature would be equally useful. This is demonstrated here:
An ''indirect'' self link is a link to a page that redirects back. In this case, the self-link feature does not work, even though the feature would be equally useful. This is demonstrated here:
*{{demo inline|<nowiki>[[Self link]]</nowiki>}}
*[[Wikipedia:Redirect#Self-redirects|Self-redirects]]


When the prefix for the project itself is added (interwiki link style, but again linking to the page itself) the self-link feature does work. This is demonstrated here:
When the prefix for the project itself is added (interwiki link style, but again linking to the page itself) the self-link feature does work, if the link has the same name as the ultimate target apart from the prefix. This is demonstrated here:
*<nowiki>[[w:Help:Self link]]</nowiki> gives [[w:Help:Self link]]
*{{demo inline|<nowiki>[[w:Help:Self link]]</nowiki>}}
*<nowiki>[[en:Help:Self link]]</nowiki> gives [[en:Help:Self link]]
*{{demo inline|<nowiki>[[en:Help:Self link]]</nowiki>}}


==Related changes feature==
==Related changes feature==
A self link for use with the [[Help:Related changes|"Related changes" feature]] only works if the link is to an existing or non-existing section. If it cannot be made useful as a link to a section, use a [[Wikipedia:Piped link|piped link]] with a blank space as label, e.g. <nowiki>[[Wikipedia:Self link#x| ]]</nowiki>, showing up as "[[Wikipedia:Self link#x| ]]".
A self link for use with the [[Help:Related changes|"Related changes" feature]] only works if the link is to an existing or non-existing section. If it cannot be made useful as a link to a section, use a [[Wikipedia:Piped link|piped link]] with a blank space as label, e.g. <syntaxhighlight lang="wikitext" inline>[[Wikipedia:Self link#x| ]]</syntaxhighlight>, showing up as "[[Wikipedia:Self link#x| ]]".


==See also==
==See also==
{{Wikipedia glossary}}
{{Wikipedia glossary}}
* [[Wikipedia:Navigation templates|Navigation templates]]
* [[Wikipedia:Navigation template|Navigation template]]
* [[Wikipedia:Manual of Style/Self-references to avoid]]
* [[Wikipedia:Manual of Style/Self-references to avoid]]
* [[Template:No selflink]] (a method to avoid the bold text on self links)


[[Category:Wikipedia link help]]
[[Category:Wikipedia link help]]

Latest revision as of 20:01, 4 October 2024

A self link is the use of a link code with the page itself as target. It does not produce an actual link, but a non-clickable bold text (the "self-link format"). However, with the preference setting "Link underlining", this text is underlined. This can be suppressed putting the following in your relevant personal css page:

.mw-selflink { text-decoration: none !important; }

Live examples (hence depending on your settings):

Self links are usually undesirable, except for:

  • Within navigation templates, where the self-link-produced boldface helps locate the article within the template
  • Self-links to a section, such as this link, which links to the section below.
[edit]

A link to a section of the same article, even from the same section, does not produce bold text and works as a normal link. For example:

[[Help:Self link#Self-link to a section]]Help:Self link#Self-link to a section

Such links should usually be written without the page name:

[[#Self-link to a section]]#Self-link to a section

because this method does not cause the page to reload if the reader initially arrived at the page via a redirect, and is thus more efficient. A useful application is links from article leads or overview sections to detail sections buried deeper in the same article. An automatically generated table of contents has links to sections on the page.

[edit]

In some cases, such as with templates that are not navigation templates, and that are transcluded into several pages, self-links can be actively suppressed by enclosing the link within the template {{No self link}}.

[edit]

An indirect self link is a link to a page that redirects back. In this case, the self-link feature does not work, even though the feature would be equally useful. This is demonstrated here:

When the prefix for the project itself is added (interwiki link style, but again linking to the page itself) the self-link feature does work, if the link has the same name as the ultimate target apart from the prefix. This is demonstrated here:

[edit]

A self link for use with the "Related changes" feature only works if the link is to an existing or non-existing section. If it cannot be made useful as a link to a section, use a piped link with a blank space as label, e.g. [[Wikipedia:Self link#x| ]], showing up as " ".

See also

[edit]