Help:Linking: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
(23 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{back|Help:Editing}}
{{LanguageBar}}
Links (sometimes called hyperlinks) are all over the web. You probably followed one to find this page.
{{Subpage|[[Help:Contents]]}}
{{Help page}}
{{toc-right}}


'''Links''' (sometimes called '''hyperlinks''') are clickable text to another web page, typically in blue. They are all over the web, you probably followed one to find this page.


To add a link to another wiki page, type <code>[[</code>, then the page name, then <code>]]</code>.
{{Important|Avoid [[w:WP:Overlink crisis|overlinking]]. You normally only need to link a term the first time it is mentioned in an article, but if the separate mentions are far apart you might want to link it more than once. Furthermore, consider your audience; you probably don't need to link to [[Source]] on a page about programming since the link may only unnecessarily distract the reader, especially if used with its icon and color such as {{source|4}}.}}
<pre>[[Main Page]]</pre>
[[Main Page]]


== Creating Links ==
To add a link to another wiki page, type <code>[[</code>, then the page name, then <code>]]</code>, for example:
:<code><nowiki>[[Main Page]]</nowiki></code> &rarr; [[Main Page]]
:<code><nowiki>[[Help Talk:Contents]]</nowiki></code> &rarr; [[Help Talk:Contents]]


If you want to link to the page but don't want to type in the exact name of the page, add a <code>|</code> between the page name and the <code>]]</code>, and then write what you want the text to be.
<pre>[[Help Talk:Contents|The discussion page]]</pre>
[[Help Talk:Contents|The discussion page]]


If you want a different display text, add a <code>|</code> between the page name and the <code>]]</code>, and then write what you want the text to be.
:<code><nowiki>[[Help Talk:Contents|The discussion page]]</nowiki></code> &rarr; [[Help Talk:Contents|The discussion page]]


To link to a page on Wikipedia, add <code>Wikipedia:</code> to your page name.
<pre>[[Wikipedia:Half-Life 2|Half-Life 2 on Wikipedia]]</pre>
[[Wikipedia:Half-Life 2|Half-Life 2 on Wikipedia]]


There are other websites you can link to as well. See [[Special:Interwiki|here]] for a full list.
If you only want to get rid of the namespace in the displayed text (everything before the first colon), then you can use the [[w:help:pipe trick|pipe trick]] by specifying an empty display text. It can also be used to remove a parenthesized part of the link title.
:<code><nowiki>[[Help Talk:Contents|]]</nowiki></code> &rarr; [[Help Talk:Contents|Contents]]
:<code><nowiki>[[Bounce (level design)]]</nowiki></code> &rarr; [[Bounce (level design)]]
:<code><nowiki>[[Bounce (level design)|]]</nowiki></code> &rarr; [[Bounce (level design)|Bounce]]




To link to somewhere outside of the wiki, type <code>[</code>, then the URL, followed by a space, the text you want to describe the link, and then <code>]</code>.
To link to a [[Help:Categories|Category]] page, you must add a colon at the beginning, otherwise you add the page to that category and nothing will be displayed.
<pre>[https://www.google.com/ External link to Google]</pre>
:<code><nowiki>[[:Category:Level Design]]</nowiki></code> &rarr; [[:Category:Level Design]]
[https://www.google.com/ External link to Google]
:<code><nowiki>[[:Category:Level Design|]]</nowiki></code> &rarr; [[:Category:Level Design|Level Design]]
 
=== Links within an article ===
It's possible to link to a section within current article by using <code>#</code> followed by section heading.
:<code><nowiki>[[#Example section|Jump to Example section section]]</nowiki></code> - [[#Example section|Jump to Example section section]]
:<code><nowiki>[[#Example section|Example section ↓]]</nowiki></code> - [[#Example section|Example section ↓]] - it's recommended to use ↑ and ↓ symbols pointing in the direction where the section is located relative to the link. It's useful to indicate where are we being moved relatively to our link and that we are not leaving the current page.
:<code><nowiki>[[#Example section 2|See also 2nd Example section ↓]]</nowiki></code> - [[#Example section 2|See also 2nd Example section ↓]]
{{note|Symbols ↑ and ↓ can be found in editing window in <code>Special characters -> Symbols</code> section}}
{{Tip|Templates {{T|↑}} and {{T|↓}} can be used for this}}
 
=== Useful [[Help:Templates|Templates]] ===
 
The template we call {{T|Ent}} is convenient for when you want to make text both a link and code at once.
:<code><nowiki>{{ent|info_player_start}}</nowiki></code> &rarr; {{ent|info_player_start}}
:<code><nowiki>{{ent|sv_cheats|1}}</nowiki></code> &rarr; {{ent|sv_cheats|1}}
 
 
The template {{T|T}} are convenient to link to a template.
:<code><nowiki>[[Template:ent]]</nowiki></code> &rarr; [[Template:ent]]
:<code><nowiki>[[Template:ent|]]</nowiki></code> &rarr; [[Template:ent|ent]]
:{{T|T|{{P|Ent}}}} &rarr; {{T|Ent}}
 
 
If you want to link to a specific game, there is most likely a template for it, such as {{T|Hl2}} for Half-Life 2. See [[Help:Templates#Per-game Templates]] for more variants. For short, it is also pretty common to use just the icon as a link. See [[:Category:Game icons|Game icons]] for a list of game icon templates.
:{{T|Hl2}} &rarr; {{Hl2}}
:{{T|Hl2|{{P|1}}}} &rarr; {{Hl2|1}}
:{{T|Hl2|{{P|4}}}} &rarr; {{Hl2|4}}
 
=== External links ===
To link to a page on the English Wikipedia, add <code>Wikipedia:</code> to the page name or just <code>w:</code> for short.
For the Wikipedia of a different language, insert the appropriate abreviation between these two like in the 4th example below.
There are other websites you can link to as well, see [[Special:Interwiki|here]] for a full list.
:<code><nowiki>[[Wikipedia:Half-Life 2|Half-Life 2 on Wikipedia]]</nowiki></code> &rarr; [[Wikipedia:Half-Life 2|Half-Life 2 on Wikipedia]]
:<code><nowiki>[[w:Half-Life 2|Half-Life 2 on Wikipedia]]</nowiki></code> &rarr; [[w:Half-Life 2|Half-Life 2 on Wikipedia]]
:<code><nowiki>[[w:Half-Life 2|]]</nowiki></code> &rarr; [[w:Half-Life 2|Half-Life 2]]
:<code><nowiki>[[w:de:Half-Life 2|]]</nowiki></code> &rarr; [[w:de:Half-Life 2|Half-Life 2]] ''(German)''




You can also just directly paste in a URL, but it doesn't look as nice
To link to somewhere outside of the wiki, type <code>[</code>, then the URL, followed by a space, the text you want to describe the link, and then <code>]</code>.
You can also just directly paste in a URL, but it doesn't look as nice.
:<code><nowiki>[https://www.google.com/ External link to Google]</nowiki></code> &rarr; [https://www.google.com/ External link to Google]
:<code><nowiki>https://www.google.com/</nowiki></code> &rarr; https://www.google.com/


https://www.google.com/


A URL pointing to an image will display that image on a page. It won't have the best formatting however. Exercise caution when doing this and note that images from another website may change or disappear at any time.
A URL pointing to an image will display that image on a page. It won't have the best formatting however. Exercise caution when doing this and note that images from another website may change or disappear at any time.


The [[Help:Templates|template]] we call [[Template:ent|ent]] is convenient for when you want to make text both a link and code at once.
== Red Links ==
If you link to a page of this site that does not exist, the link text will turn <span style=color:#D64B4B>red</span>. This does not apply to Wikipedia or External links.


==Red (broken) links==
It's O.K. to link to a non-existent page! We would prefer that you then created that page, if you know about it. What we don't want is a page that's just "todo: make this page".
It's O.K. to link to a non-existent page! We would prefer that you then created that page, if you know about it. What we don't want is a page that's just "todo: make this page".


If you've created a page and pre-existing links to it still show as red, add <code>?action=purge</code> to the end of the URLs to update their link colors. You can also do this by pressing the '''Edit''' button on the pages and saving them without changing anything.
If you've created a page and pre-existing links to it still show as red, add <code>?action=purge</code> to the end of the URLs to update their link colors. You can also do this by pressing the '''Edit''' button on the pages and saving them without changing anything.


{{note|Broken links are only detected for wiki pages, not external or Wikipedia links.}}
== Link Colors ==
 
==Link Colors==
{| class=standard-table
{| class=standard-table
!Type of Link||Before Visiting||After Visiting
!Type of Link||Before Visiting||After Visiting
|-
|-
!wiki pages and external links||<span style="color:#8BB9E0">#8BB9E0</span>||<span style="color:#002bb8">#002BB8</span>
!Wiki pages and External links||<span style="color:#8BB9E0">#8BB9E0</span>||<span style="color:#002bb8">#002BB8</span>
|-
|-
!Inter-wiki links||<span style="color:#36b">#36B</span>||<span style="color:#551A8B">#551A8B</span>
!Inter-wiki links||<span style="color:#36b">#36B</span>||<span style="color:#551A8B">#551A8B</span>
Line 53: Line 92:
Links that link to their own pages (excluding ones redirecting to other sections) will appear to be [[Help:Linking|bold]].
Links that link to their own pages (excluding ones redirecting to other sections) will appear to be [[Help:Linking|bold]].


==See Also==
== Example section ==
[[#Links within an article|Links within an article ↑]]
.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>
 
== Example section ==
[[#Links within an article|Links within an article ↑]]<br/>
If there are two sections with same name each subsequent section can be linked by adding number of the section behind the link. Linking to this section would look like this
* <code><nowiki>[[#Example section 2]]</nowiki></code> - [[#Example section 2]]
{{Tip|Can also use browser's <code>Inspect element</code> function to see HTML of the page and check for <code>id</code> attribute of the wanted section}}
 
== See also ==
*[[Help:Redirects]]
*[[Help:Redirects]]
*[[Special:BrokenRedirects]] - pages that need to have redirect links fixed.
*[[Special:BrokenRedirects]] - Pages that need to have redirect links fixed.
*[[Special:DeadendPages]] - pages that need more links on them.
*[[Special:DeadendPages]] - Pages that need more links on them.
*[[Special:DoubleRedirects]] - Redirects that need to be fixed (chaining is bad).
*[[Special:DoubleRedirects]] - Redirects that need to be fixed (chaining is bad).
*[[Special:LinkSearch]] - Search through external links.
*[[Special:LinkSearch]] - Search through External links.
*[[Special:ListRedirects]] - List of all redirects.
*[[Special:ListRedirects]] - List of all redirects.
*[[Special:LonelyPages]] - Pages that need to be linked to in other places.
*[[Special:LonelyPages]] - Pages that need to be linked to in other places.
*[[Special:MostInterwikis]] - Lists pages with the highest number of links to other wikis. (as of July 23rd, 2018 it seems no pages link to more than one?)
*[[Special:MostLinkedCategories]] - Lists [[Help:Categories|categories]] that are most frequently linked to by other pages.
*[[Special:MostLinkedPages]] - Most linked-to pages.
*[[Special:MostLinkedPages]] - Most linked-to pages.
*[[Special:PermanentLink]] - Generates permanent links for pages. Seems to not work currently.
*[[Special:RecentChangesLinked]] - Lists all recent changes to pages that are linked to by a certain page.
*[[Special:WantedPages]] - Pages that are linked to a lot, but do not exist.
*[[Special:WantedPages]] - Pages that are linked to a lot, but do not exist.
*[[Special:WhatLinksHere]] - Shows pages that have links to a specific page.
[[Category:Wiki]]

Latest revision as of 11:15, 28 March 2025

English (en)Translate (Translate)
Edit-copy.png
This is a help page
That means that this article contains information intended to advise or aid on the functions of the wiki, on how to use the wiki, or on general recommendations for users of the wiki.

Links (sometimes called hyperlinks) are clickable text to another web page, typically in blue. They are all over the web, you probably followed one to find this page.

Icon-Important.pngImportant:Avoid overlinking. You normally only need to link a term the first time it is mentioned in an article, but if the separate mentions are far apart you might want to link it more than once. Furthermore, consider your audience; you probably don't need to link to Source on a page about programming since the link may only unnecessarily distract the reader, especially if used with its icon and color such as Source Source.

Creating Links

To add a link to another wiki page, type [[, then the page name, then ]], for example:

[[Main Page]]Main Page
[[Help Talk:Contents]]Help Talk:Contents


If you want a different display text, add a | between the page name and the ]], and then write what you want the text to be.

[[Help Talk:Contents|The discussion page]]The discussion page


If you only want to get rid of the namespace in the displayed text (everything before the first colon), then you can use the pipe trick by specifying an empty display text. It can also be used to remove a parenthesized part of the link title.

[[Help Talk:Contents|]]Contents
[[Bounce (level design)]]Bounce (level design)
[[Bounce (level design)|]]Bounce


To link to a Category page, you must add a colon at the beginning, otherwise you add the page to that category and nothing will be displayed.

[[:Category:Level Design]]Category:Level Design
[[:Category:Level Design|]]Level Design

Links within an article

It's possible to link to a section within current article by using # followed by section heading.

[[#Example section|Jump to Example section section]] - Jump to Example section section
[[#Example section|Example section ↓]] - Example section ↓ - it's recommended to use ↑ and ↓ symbols pointing in the direction where the section is located relative to the link. It's useful to indicate where are we being moved relatively to our link and that we are not leaving the current page.
[[#Example section 2|See also 2nd Example section ↓]] - See also 2nd Example section ↓
Note.pngNote:Symbols ↑ and ↓ can be found in editing window in Special characters -> Symbols section
Tip.pngTip:Templates {{}} and {{}} can be used for this

Useful Templates

The template we call {{Ent}} is convenient for when you want to make text both a link and code at once.

{{ent|info_player_start}}info_player_start
{{ent|sv_cheats|1}}sv_cheats 1


The template {{T}} are convenient to link to a template.

[[Template:ent]]Template:ent
[[Template:ent|]]ent
{{T|Ent}}{{Ent}}


If you want to link to a specific game, there is most likely a template for it, such as {{Hl2}} for Half-Life 2. See Help:Templates#Per-game Templates for more variants. For short, it is also pretty common to use just the icon as a link. See Game icons for a list of game icon templates.

{{Hl2}}Half-Life 2
{{Hl2|1}}Half-Life 2
{{Hl2|4}}Half-Life 2 Half-Life 2

External links

To link to a page on the English Wikipedia, add Wikipedia: to the page name or just w: for short. For the Wikipedia of a different language, insert the appropriate abreviation between these two like in the 4th example below. There are other websites you can link to as well, see here for a full list.

[[Wikipedia:Half-Life 2|Half-Life 2 on Wikipedia]]Half-Life 2 on Wikipedia
[[w:Half-Life 2|Half-Life 2 on Wikipedia]]Half-Life 2 on Wikipedia
[[w:Half-Life 2|]]Half-Life 2
[[w:de:Half-Life 2|]]Half-Life 2 (German)


To link to somewhere outside of the wiki, type [, then the URL, followed by a space, the text you want to describe the link, and then ]. You can also just directly paste in a URL, but it doesn't look as nice.

[https://www.google.com/ External link to Google]External link to Google
https://www.google.com/https://www.google.com/


A URL pointing to an image will display that image on a page. It won't have the best formatting however. Exercise caution when doing this and note that images from another website may change or disappear at any time.

Red Links

If you link to a page of this site that does not exist, the link text will turn red. This does not apply to Wikipedia or External links.

It's O.K. to link to a non-existent page! We would prefer that you then created that page, if you know about it. What we don't want is a page that's just "todo: make this page".

If you've created a page and pre-existing links to it still show as red, add ?action=purge to the end of the URLs to update their link colors. You can also do this by pressing the Edit button on the pages and saving them without changing anything.

Link Colors

Type of Link Before Visiting After Visiting
Wiki pages and External links #8BB9E0 #002BB8
Inter-wiki links #36B #551A8B
Broken links #D64B4B #BA0000

Links that link to their own pages (excluding ones redirecting to other sections) will appear to be bold.

Example section

Links within an article ↑ .
.
.
.
.
.

Example section

Links within an article ↑
If there are two sections with same name each subsequent section can be linked by adding number of the section behind the link. Linking to this section would look like this

Tip.pngTip:Can also use browser's Inspect element function to see HTML of the page and check for id attribute of the wanted section

See also