Jump to content

Help:Contributing/links: Difference between revisions

From Wikibase
Fix the same-page section-link example (restore the #See also anchor case) (via update-page on MediaWiki MCP Server)
 
(10 intermediate revisions by 2 users not shown)
Line 32: Line 32:


<blockquote>
<blockquote>
The first letter of the target is not case-sensitive — <syntaxhighlight lang="text" inline>[[main Page]]</syntaxhighlight> and <syntaxhighlight lang="text" inline>[[Main Page]]</syntaxhighlight> are the same link. Every later letter must match the page title exactly: <syntaxhighlight lang="text" inline>[[Item:q162]]</syntaxhighlight> is a red link, not the item. Spaces in a title are interchangeable with underscores.
The first letter of the target is not case-sensitive — <syntaxhighlight lang="text" inline>[[main Page]]</syntaxhighlight> and <syntaxhighlight lang="text" inline>[[Main Page]]</syntaxhighlight> are the same link. '''Every later letter is case sensitive'''.  
 
Spaces are interchangeable with underscores.
</blockquote>
</blockquote>


<blockquote>
<blockquote>
Linking to the page you are editing renders as bold text, not as a link.
To include a category page as an internal link, write <code>[[<nowiki/>!Category:]]</code>, as <code>[[Category:]]</code> would instead add current page to that category.
</blockquote>
</blockquote>


Line 44: Line 46:


A piped link with an empty label shows an abbreviated title — the namespace is dropped: <syntaxhighlight lang="text" inline>[[Item:Q162|]]</syntaxhighlight> shows [[Item:Q162|Q162]].
A piped link with an empty label shows an abbreviated title — the namespace is dropped: <syntaxhighlight lang="text" inline>[[Item:Q162|]]</syntaxhighlight> shows [[Item:Q162|Q162]].
=== Classic per-kind pages ===
The five classic per-kind namespaces are shortened automatically for an '''unpiped''' link: <code>Person:</code>, <code>Collective:</code>, <code>Source:</code>, <code>FOSS:</code> and <code>Software:</code>. The namespace prefix is dropped, and a <code>Source:</code> link is additionally italic:
{| class="wikitable" style="width:100%"
! What you type !! What you get
|-
| <syntaxhighlight lang="text" inline>[[Person:Edwin Hubble]]</syntaxhighlight>
| [[Person:Edwin Hubble]]
|-
| <syntaxhighlight lang="text" inline>[[Collective:Club of Rome]]</syntaxhighlight>
| [[Collective:Club of Rome]]
|-
| <syntaxhighlight lang="text" inline>[[Source:Beloved]]</syntaxhighlight>
| [[Source:Beloved]]
|}
A pipe still controls the display text: <syntaxhighlight lang="text" inline>[[Person:Edwin Hubble|Hubble]]</syntaxhighlight> shows [[Person:Edwin Hubble|Hubble]]. The '''Copy internal mention''' button on those pages copies the bare <syntaxhighlight lang="text" inline>[[Person:Edwin Hubble]]</syntaxhighlight> (no pipe), so the renderer supplies the caption. '''Right-click''' the button for '''Capitalise first letter''', which copies the same link with the page name's first letter capitalised after the namespace (the target resolves to the same page).


To make one title an alias of another, put <syntaxhighlight lang="text" inline>#REDIRECT [[Main Page]]</syntaxhighlight> as the first line of the page — it then redirects to the target. See [https://www.mediawiki.org/wiki/Help:Redirects Help:Redirects] (official).
To make one title an alias of another, put <syntaxhighlight lang="text" inline>#REDIRECT [[Main Page]]</syntaxhighlight> as the first line of the page — it then redirects to the target. See [https://www.mediawiki.org/wiki/Help:Redirects Help:Redirects] (official).
Line 71: Line 92:
</blockquote>
</blockquote>


Every heading also carries two copy controls next to its <code>[edit]</code> link: '''Copy internal mention''' copies <code>[[Page title#section|</code> (without the closing brackets — type your own display text after the final pipe), and '''Copy URL''' copies the section's absolute web address.
=== Automatic anchors ===
 
A heading that mixes text and math stays linkable: the <code>$…$</code> math is dropped from the anchor, and a heading that is '''only''' math keeps it (normalised, so the characters that cannot appear in a fragment — <code># &lt; &gt; [ ] | { }</code> — become <code>_</code>).
 
{| class="wikitable" style="width:100%"
! Heading !! Link
|-
| <syntaxhighlight lang="text" inline>=== Symmetric groups $\mathcal{S}_{n}$ ===</syntaxhighlight>
| <syntaxhighlight lang="text" inline>[[Page#Symmetric_groups]]</syntaxhighlight>
|-
| <syntaxhighlight lang="text" inline>=== $\operatorname{sign}(\sigma)$ ===</syntaxhighlight>
| the normalised math is kept
|}
 
The section's <code>[Copy internal mention]</code> and <code>[Copy URL]</code> use the automatic anchor.
 
=== Explicit anchors ===
 
For a different, readable anchor — especially for a math-only or long heading — put <syntaxhighlight lang="text" inline>{{anchor|Name}}</syntaxhighlight> at the start of the heading. It wins over the automatic one:
 
<syntaxhighlight lang="text" inline>=== {{anchor|sign composition}} $\operatorname{sign}(\sigma_1 \circ \sigma_2)$ ===</syntaxhighlight>
 
Now <syntaxhighlight lang="text" inline>[[Permutation#sign composition]]</syntaxhighlight> works. See [[Template:Anchor]] for the template's rules.
 
=== Section controls ===
 
Every heading also carries four controls next to its <code>[edit]</code> link, each in its own pair of brackets — just like <code>[edit]</code>. They appear on every classic page (article namespaces, <code>Help:</code>, and the <code>Source:</code>/<code>Person:</code>/<code>Collective:</code>/<code>FOSS:</code>/<code>Software:</code> pages), not only on content pages:
 
* <code>[Copy internal mention]</code> copies <code>[[Page title#section|</code> (without the closing brackets — type your own display text after the final pipe); '''right-click''' the control for '''Capitalise first letter''', which copies the same snippet with the page name's first letter capitalised;
* <code>[Copy URL]</code> copies the section's absolute web address;
* <code>[Add section below]</code> opens the editor targeting that section, inserting your content at its end;
* <code>[Delete section]</code> opens a confirmation page that shows the section, then removes the whole section (heading and any subsections) when you confirm.
 
The editor behind the page-wide <code>Add section</code> action and <code>[Add section below]</code> '''is''' the ordinary '''Edit''' page — the same wikitext toolbar, with '''Show preview''' and '''Show changes''' — and just one difference: it has no '''This is a minor edit''' checkbox. It ''appends'' your content instead of replacing the page. Leave the '''Summary''' blank and it is filled in from the first heading of your content (the section-edit convention: a <code>== Vandermonde ==</code> heading gives <code>/* Vandermonde */</code>).
 
== Subpages ==
 
A <code>/</code> in a title creates a hierarchy. <code>Matrix/Practice/Matrix_multiplication</code> is a subpage of <code>Matrix/Practice</code>, itself a subpage of <code>Matrix</code>; the child shows a breadcrumb back to the parent. Subpages are enabled in every namespace, including the main one. Create the parent page first — the breadcrumb only links ancestors that exist.


== External links ==
== External links ==

Latest revision as of 18:48, 13 November 2026

Languages: English · français · Esperanto

Links connect the pages of this wiki to each other and to the outside world. This page covers the link syntax you will use day to day: internal links, links to sections, external links and interwiki shortcuts.

A wikilink points to another page on this wiki. Write the page title inside double square brackets.

What you want What you type What you get
Link to a page [[Main Page]] Main Page
Link with your own label — the part after the pipe is shown [[Help:Contributing|the contributor hub]] the contributor hub
Link to an item — entity pages are ordinary pages here [[Item:Q162|Blue Marble (photograph)]] Blue Marble (photograph)
Link to a property [[Property:P1|instance of]] instance of
Link to a page that does not exist — a red link [[My new page]] My new page

Following a red link opens the editor for that page: a red link is an invitation to create the page.

The first letter of the target is not case-sensitive — [[main Page]] and [[Main Page]] are the same link. Every later letter is case sensitive.

Spaces are interchangeable with underscores.

To include a category page as an internal link, write [[!Category:]], as [[Category:]] would instead add current page to that category.

Prefer an internal link whenever the target lives on this wiki. A red link invites someone to create the page; an external link to the same page does not.

A piped link with an empty label shows an abbreviated title — the namespace is dropped: [[Item:Q162|]] shows Q162.

Classic per-kind pages

The five classic per-kind namespaces are shortened automatically for an unpiped link: Person:, Collective:, Source:, FOSS: and Software:. The namespace prefix is dropped, and a Source: link is additionally italic:

What you type What you get
[[Person:Edwin Hubble]] Edwin Hubble
[[Collective:Club of Rome]] Club of Rome
[[Source:Beloved]] Beloved

A pipe still controls the display text: [[Person:Edwin Hubble|Hubble]] shows Hubble. The Copy internal mention button on those pages copies the bare [[Person:Edwin Hubble]] (no pipe), so the renderer supplies the caption. Right-click the button for Capitalise first letter, which copies the same link with the page name's first letter capitalised after the namespace (the target resolves to the same page).

To make one title an alias of another, put #REDIRECT [[Main Page]] as the first line of the page — it then redirects to the target. See Help:Redirects (official).

Every heading is an automatic anchor, so a link can point straight at a section.

What you want What you type What you get
A section on another page [[Help:Contributing/code#House rules|house rules]] house rules
A section on the same page [[#See also|jump to the end]] jump to the end
The top of the page [[#top|back to top]] back to top

The anchor is the heading text as written: if the heading is renamed, links to that section break.

Automatic anchors

A heading that mixes text and math stays linkable: the $…$ math is dropped from the anchor, and a heading that is only math keeps it (normalised, so the characters that cannot appear in a fragment — # < > [ ] | { } — become _).

Heading Link
=== Symmetric groups $\mathcal{S}_{n}$ === [[Page#Symmetric_groups]]
=== $\operatorname{sign}(\sigma)$ === the normalised math is kept

The section's [Copy internal mention] and [Copy URL] use the automatic anchor.

Explicit anchors

For a different, readable anchor — especially for a math-only or long heading — put {{anchor|Name}} at the start of the heading. It wins over the automatic one:

=== {{anchor|sign composition}} $\operatorname{sign}(\sigma_1 \circ \sigma_2)$ ===

Now [[Permutation#sign composition]] works. See Template:Anchor for the template's rules.

Section controls

Every heading also carries four controls next to its [edit] link, each in its own pair of brackets — just like [edit]. They appear on every classic page (article namespaces, Help:, and the Source:/Person:/Collective:/FOSS:/Software: pages), not only on content pages:

  • [Copy internal mention] copies [[Page title#section| (without the closing brackets — type your own display text after the final pipe); right-click the control for Capitalise first letter, which copies the same snippet with the page name's first letter capitalised;
  • [Copy URL] copies the section's absolute web address;
  • [Add section below] opens the editor targeting that section, inserting your content at its end;
  • [Delete section] opens a confirmation page that shows the section, then removes the whole section (heading and any subsections) when you confirm.

The editor behind the page-wide Add section action and [Add section below] is the ordinary Edit page — the same wikitext toolbar, with Show preview and Show changes — and just one difference: it has no This is a minor edit checkbox. It appends your content instead of replacing the page. Leave the Summary blank and it is filled in from the first heading of your content (the section-edit convention: a == Vandermonde == heading gives /* Vandermonde */).

Subpages

A / in a title creates a hierarchy. Matrix/Practice/Matrix_multiplication is a subpage of Matrix/Practice, itself a subpage of Matrix; the child shows a breadcrumb back to the parent. Subpages are enabled in every namespace, including the main one. Create the parent page first — the breadcrumb only links ancestors that exist.

External links point to other websites. The URL comes first, the label after, inside single square brackets.

What you want What you type What you get
Labelled link [https://www.mediawiki.org MediaWiki] MediaWiki
Bare URL — linked automatically, no brackets needed https://www.mediawiki.org https://www.mediawiki.org
No label — numbered automatically [https://www.mediawiki.org] [1]

The URL and its label must stay on one line: a line break inside the brackets breaks the link, and the [ shows up literally.

External links carry a small arrow icon to show they leave this wiki.

Interwiki links are shortcuts to other wikis, written like internal links with a prefix. This wiki comes with the standard prefixes: wikipedia, wikidata, commons, mw, and more.

What you want What you type What you get
A Wikipedia article [[wikipedia:Sunflower|sunflower]] sunflower
A Wikidata item [[wikidata:Q42|Q42]] Q42
A MediaWiki help page [[mw:Help:Links|MediaWiki help]] MediaWiki help

Remote pages always render blue — interwiki links do not check whether the target page exists on the other wiki. The full list of prefixes is on Special:Interwiki.

The language versions of this wiki's pages are linked with the {{Languages}} bar, not interlanguage markup — see Languages and translation.

Files and categories

A leading colon makes a file or category link visible as text instead of performing its action.

What you want What you type What you get
A text link to a file page [[:File:Example.png|Example.png]] Example.png
A text link to a category [[:Category:HowItWorks]] Category:HowItWorks

Without the colon, [[File:…]] embeds the file and [[Category:…]] is treated as a plain page under the Category namespace.

Embedding images and media is covered in Help:Contributing/richMediaContent.

Markdown syntax does not work with wikis

  • Internal links is: [[Page title]], not [text](url).
  • External links is [https://example.com label], not [label](https://example.com).

See also