Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Help:Link
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Section linking (anchors) == {{shortcut|WP:ANCHOR}} {{see also|Help:Section#Section linking|Wikipedia:Manual of Style/Linking#Section links}} To link to a section or subsection in another page, append a <code>#</code> and the section name to the page name: :{{nowrap|<code><nowiki>[[Page name#Section name|displayed text]]</nowiki></code>}} For linking in the same page, omit the page name and use a <code>#</code> and the section name: :{{nowrap|<code><nowiki>[[#Section name|displayed text]]</nowiki></code>}} Omitting the page name is recommended when linking to a section in the same page because the link will work as expected when previewing changes or after moving the page. To format a link with the [[section sign]] (§) instead of a # (e.g. {{section link|Page name|Section name}} rather than [[Page name#Section name]]), use the template {{tl|Section link}} (alias {{tl|slink}}): :{{nowrap|<code><nowiki>{{Section link|Page name|Section name}}</nowiki></code>}} Note that section names are entirely case sensitive, in contrast to article links, where the first letter is not case sensitive. The characters <code>[ ] { | }</code> require encoding when linking to a section: {| class="wikitable" ! [ !! ] !! { !! <nowiki>|</nowiki> !! } |- | .5B || .5D || .7B || .7C || .7D |} For example, the section "[Closed] Complaint" can be linked with <code><nowiki>[[#.5BClosed.5D Complaint]]</nowiki></code>. Links in the table of contents will automatically make this encoding, so the URL can be copied from there. However, that URL will also encode other characters which do not interfere with templates or wikicode, so the result may look ugly. For more information, see [[Help:Section]]. See also {{slink|Wikipedia:Redirect|Targeted and untargeted redirects}}. ===Specifics=== When a link contains a section title (as in the examples above), the title actually points to an HTML ''[[HTML element#Anchor |anchor]]'' on the target page. In addition to anchors created automatically by section titles, there are times when it's advantageous to create an anchor on a smaller unit of text, such as a specific paragraph (see {{section link ||Linking to part of a section}} below). This can be done using {{tl2|Anchor|anchor name}}, or alternatively, the [[HTML]] code {{nowrap|<code><nowiki><span id="anchor name">...</span></nowiki></code>}} (see {{tl|Anchor}} syntax). Anchors are also used when renaming a section, yet still allowing links to the old name to function, or similarly, allowing linking to a section using an abbreviation; see [[MOS:HEADINGS]] for more info. Links to anchors can also be added to external URLs and to interwiki links, again using the <code>#</code> syntax. Section links still work through page names that are [[Help:Redirect|redirects]]. For example, if [[Danzig]] redirects to [[Gdańsk]], then [[Danzig#History]] will link to the "History" section of the article Gdańsk. It is also possible for the target of a redirect to be defined as a specific section or anchor of a page (these work only if JavaScript is enabled). Indeed, [[MOS:SECTLINK |according to the Manual of Style]], it may be preferable to define such redirects, and use them when linking to those sections/anchors, rather than linking using the {{nowrap |<code><nowiki>[[Page name#Section or anchor name|displayed text]]</nowiki></code>}} or {{nowrap |<code><nowiki>{{Section link|Page name|Section name}}</nowiki></code>}} syntax. This way, if the section or anchored text later becomes its own article, links via the redirect won't need to be rewritten. For example, [[Wikipedia:Section link]] redirects specifically to the section [[Help:Link#Section linking (anchors)]] on this page. A quirk of the way this works is that if one were to add a section name when using such a link, it would override the section specified by the redirect. So [[Wikipedia:Section link#Interwiki links]] would go to the "Interwiki links" section of this page. Such overriding of section redirects should be avoided. The {{tl|Visible anchor}} template can be used to create {{visible anchor|Visible anchor example|text=an anchor that is highlighted when is linked to}} ([[#Visible anchor example|click here for an example]]). The template's first parameter will be used as both the anchor and the display text ({{para|text}} can be used to provide different display text). ===Duplicate section names=== {{Shortcut|WP:DUPSECTNAME}} If more than one section on a destination page has the same title, a link to the title is to the first section with that title. If the link should be to another section with the title or a title that differs only in capitalization (Example vs. EXAMPLE), append to the linked title _2, _3, and so on, without a space (or 2, 3, and so on ''with'' a space), counting from the top of the destination page and without regard to whether a section is a section or a subsection. For example, multiple sections titled "History" may be linked to as "History", "History_2" (or "History 2"), and so on. ===Linking to part of a section=== {{shortcut|WP:LINKPART}} {{see also|#Table row linking}} Anchors can also be used to link to any part of a section. For example, if you want to link to the fifth sentence of a section, you place an anchor at the start of that sentence, and you can then link to that anchor in the same way as you would link to any other anchor. However, just as with section names, duplicate anchor names only link to the first one. Since anchors aren't displayed you have a much greater freedom in picking unique anchors, such as by appending the current date and time to the anchor name (for example, by naming an anchor for section "ThisSection" like so: <nowiki>{{Anchor|ThisSection2014-09-22-18-05a1}}</nowiki> ). Anchors can be placed anywhere, including at the start of a clause, and inside notes and citations, though it is advisable to test first in your [[Draft:Sandbox|sandbox]] before trying some exotic new kind of location for the first time. Also the anchor has to be placed after any indicators that are only recognized at the start of a line (such as == or ===, etc., for new section, * for new bullet point, : for indentation), as the anchor should still work, but the start-of-line indicator usually no longer will (and you may not always notice this, perhaps especially if you are in a hurry). There are a small number of special anchor names. See {{slink|#Table row linking}}.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)