Help:Links

From FasciPedia
Revision as of 00:07, 5 December 2022 by Deleted User (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
FasciPedia help page

A link has various (changeable) appearances on the "anchor" page, and the "target" page, which owns the "backlinks", and which can count the links to it with the What links here tool.

For a short list of some basic shortcuts, see Fascipedia:Cheatsheet.

For guidelines on how links should be used in Wikipedia, see Fascipedia:Manual of Style.

Internal links

A internal link is a link from one page to another page within Fascipedia, in other words: within the same domain.

Links are enclosed in doubled square brackets:

  • [[1234]] is seen as "1234" in text and links to (the top of) page "1234".

Use a vertical bar "|" (the "pipe" symbol) to create a link which appears as a term other than the name of the target page. Links of this kind are said to be "piped". The first term inside the brackets is the title of the page you would be taken to (the link target), and anything after the vertical bar is what the link looks like for the reader on the original page (the link label). For example:

  • [[a|b]] appears as "b" but links to page "a", thus: b.

See Help:Pipe trick for how to generate some common forms of piped links without typing text after the "|".

Letters and other non-punctuation text immediately (i.e. without space) after the closing brackets of a wikilink becomes part of the label (means: is shown in the same colour as the label) without changing the target. This is useful for plurals and verb forms which only add something at the end. For example:

  • [[apple]]s generates apples, linking to apple, and is equivalent to but more convenient than [[apple|apples]].

But this not only saves the active editor time but it also makes the code easier to be read. The latter is why it should always be done where applicable.

More complicated examples:

  • [[a|b]]c gives bc, equivalent to [[a|bc]] .
  • a[[b]] gives ab. There are no special rules for text preceding a wikilink.
  • If you want the "a" in front in the colour of the link, you have to write
    [[b|ab]] gives ab.
  • [[a]]:b gives a:b since the rule doesn't apply to punctuation.
    This does the right thing for possessives, like [[Batman]]'s gives Batman's.
  • [[a]]''b'' gives ab. (Double apostrophes turn on and off italics.)
  • Even italics in the link: [[a|a''b'']] gives ab, but, of course, in colour.
  • [[a]]<nowiki />b gives ab. The nowiki tag turns off the rule.
  • [[a|b]]<nowiki />c gives bc.

The link target is case-sensitive except for the first character (so [[atom]] links to "Atom" but [[ATom]] does not, it links to another page).

If the target of a link does not exist, it is displayed in red color and is called a "red link". Here is a red link example.

To see what the tool tip tells you about a red link and what is displayed at the bottom left corner, move your mouse pointer into this red link.

If a red link is clicked, the user is taken to a blank page where it is possible to create a page using that red linked title. While on that blank page, other red links to this (non-existent) title can be detected using the "What links here" feature.

If the target of a link is the same as the page on which it appears (a self-link), it is displayed in bold font, as with: Help:Link. Yes, its wiki code is actually [[Help:Link]]. But it is not in the usual link colour, and it does not react as a link does; if the mouse pointer is in it, the mouse pointer looks like being in/over plain text.

When an edit is previewed before saving, if the target of a newly made link turns out to be a disambiguation page, the link should be changed to one of the choices on that page unless the link is purposeful in a hatnote. Readers should not be directed to disambiguation pages unless there is no other option but to do so.

Attempting to link normally to an image page, or category page will produce a different effect: this will respectively place the image on the page. To override this behavior, insert an initial colon ":", as in [[:File:Fasces.png]], or [[:Category:Help]].

Inserting and deleting internal links

  • Editing source links are inserted or deleted simply by adding or removing pairs of square brackets enclosing the text concerned (plus handling piped links).

There are some helpful tools:

  • When using the visual editor, selecting some text, then clicking the link icon above the text box (two links of a chain) will allow the link to be added, offering a selection of possible matches and the ability to pipe.
  • When using the source editor, selectable from Preferences > Gadgets > Editing, there is a "link" button (typically the first button on the bottom row). When editing, if some text is highlighted, clicking the link button will enclose it in double quotes, i.e., Link it. If, however, some text is highlighted that includes one or more internal links, in many cases just a single internal link with its delimiting brackets, they will be removed instead. For a single link without pipe, the link button will toggle between linking and unlinking.

External links

External links use URLs to link directly to any web page on the internet. External links are enclosed in single square brackets (rather than double brackets as with internal links), with the optional link text separated from the URL by a space (not a "|" as with internal links). When rendered, external links are followed by an external link icon. For example,

[http://www.example.org/ link text]

will be rendered as

link text.

The URL must be specified in full, including the protocol: for example [http://...] or [https://...]. Short form URLs that are accepted in some other contexts like [example.org/ link text] or [www.example.org/ link text] are not accepted and will not result in a link being generated. Instead, the link generating markup including the square brackets will be copied directly to the marked-up output, thus "[example.org/ link text]" or "[www.example.org/ link text]".

When no link text is specified, external links appear numbered: [http://www.example.org/some-page][http://www.example.org/some-other-page] becomes [1][2]. Links with no square brackets display in their entirety: http://www.example.org/ displays as http://www.example.org/.

Also note that Special:LinkSearch can be used to find all pages linking to a given site.

The external link syntax can also be used to link to particular pages within Fascipedia that are not accessible by wikilinks, such as page history, the edit view, an old version of a page, the diff between two versions, etc. It can also be used to create a navigational image.

To display an external link without the arrow icon, place the external link syntax between <span class="plainlinks">...</span> tags.


What is an "anchor"?

The word "anchor" has two opposing meanings:

  • In the context of a link from an anchor to a target, it is the starting place.
  • In the context of the template {{anchor}}, an "anchor" is a landing place for a link to jump to.
    This place/location even can be the gap between two letters.

The anchor template proceeds to automatically create some invisible coding from certain text in the template in the "landing place", taking into account certain parameters in reference templates in general.
So, for developers, the word "anchor" may refer

  • to the text and parameters, in the template, from which the invisible code is created,
  • to the mostly invisible HTML code, or
  • to the landing place/location/spot in itself.

Section linking (anchors)

To link to a section or subsection in another page, append a # and the section name to the page name:

[[Page name#Section name|displayed text]]

If linking in the same page, omit the page name and use a # and the section name:

[[#Section name|displayed text]]

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.

Note that Section names are entirely case sensitive, in contrast to article links, where the first letter is not case sensitive.

Template

To link to a section so that it is formatted with the section symbol instead (Template:Section link rather than as Page name#Section name), use the template {{Section link}} (or {{slink}}):

{{Section link|Page name|Section name}}

When using the template, certain characters [ ] { | } require encoding when linking to a section:

[ ] { | }
.5B .5D .7B .7C .7D

For example, the section "[Closed] Complaint" can be linked with [[#.5BClosed.5D Complaint]]. 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.

Specifics

When a link contains a section title (as in the examples above), the title actually points to an HTML 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 Template:Section link below). This can be done using the HTML code <span id="anchor name">...</span> 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; Links to anchors can also be added to external URLs, again using the # syntax.

Section links still work through page names that are redirects.

Using a redirect as alternative

An alternative to a piped link is simply using redirect pages. To create How to set up a coffee house, use [[How to set up a coffee house]] and make this a redirect to coffeehouse setup (note that, unlike previously, the tooltip that shows when you point at the link, if applicable for your browser, is simply the text already shown).

This is convenient if the redirect is already there or will also be of use elsewhere; however, there are a few drawbacks:

  • the tooltip does not show the page one will arrive at
  • "Related changes" gives the changes in the redirect page not the redirect target
  • the redirect message on the target page slightly clutters it

Combining a piped link and a redirect, one can provide some information that is not the name of the page one links to in the hover tooltip, i.e. the following pipe to a redirect [[United Nations Organization|UNO]] will display a tooltip "United Nations Organization" when hovering over UNO, thereby explaining the abbreviation.

Automatic conversion of wikitext with the pipe trick

If in a piped link the part after the "|" is left empty, it is converted to an abbreviated form of the linked page, as follows:

  1. Any word before the first colon (:), as well as the colon itself, is removed. This word may or may not be a namespace prefix (such as "Help:") or an interwiki prefix (such as "commons:"). If the page name is preceded by a colon, "first" refers to "first after this".
  2. If there is text in parentheses at the end it will be removed.
  3. If there are no parentheses but there is a comma, the comma and everything after it are removed.
  4. The link will be in whatever case is used.

Just like for the three or four tildes when signing on Talk pages and the use of subst, in a preview, the result already shows up in the preview itself, but the conversion in the edit box is not yet shown. Press "Show changes" to see the change in the wikitext.

Category tag
The sort key syntax of the category being like a piped link, the pipe trick also works for category tags, even though it is not useful there.
Examples using colons
[[Help:Template|]] is converted to [[Help:Template|Template]], which is rendered as Template.
[[Music: My life|]] is converted to [[Music: My life| My life]], which is rendered as My life – although "Music:" is not a namespace (therefore the space after the colon is not automatically removed), the shortcut works anyway.

Inverse pipe trick

On page "A (c)", [[|B]] is automatically converted to [[B (c)|B]].

Similarly, on page "A, c", [[|B]] is automatically converted to [[B, c|B]].

Special pages links

To create a link to a special page:

Because the ampersand character (&) is disallowed, it is not possible to create an ordinary link containing &action=edit or &redirect=no in the URL query string. In these cases, use templates or magic words, see #Links containing URL query strings.


Changing link appearance

The ways that various links are displayed in browsers, as described above, are the default display styles in the default skin. Users can change the way they see links:

  • By selecting a different skin.
  • By applying a user style using CSS.
  • By changing the "Underline links" or "Format broken links like this" value on the Appearance tab of user preferences.
  • By setting the "threshold for stub display" on the Appearance tab of user preferences. This causes links to pages in mainspace to be displayed in a distinctive fashion – dark red by default – if the wikitext of the target page has less than a specified number of bytes. (Any section markers in the link are ignored. Links to redirects are displayed in the normal style.)

Disallowed characters

A link whose target contains disallowed characters will be displayed without markup, as in [[A{b}]].

Conversions are automatically made to [ literal characters in links. For example, [[Help:Page%20name]] becomes Help:Page name. However, the opposite is true for external links; literal characters are converted into non-literal characters. For example, most browsers convert .../wiki/! to .../wiki/%21.

Some characters in a web address link need to be represented as escape characters because they are reserved for Fascipedia edits. Examples include %5B for [, %5D for ], %3C for <, %3E for >, %7B for {, %7D for }, %7C for |, and %26 for &. In excessive cases, an automatic percent encoder such as the one at W3 Schools (use the second JavaScript form under "URL Encoding Functions") is probably the simplest solution.

Conversion to canonical form

As described previously, if a link target begins with a lower case letter, it will be interpreted as if it began with the equivalent capital letter. If the target contains a namespace prefix, then the whole prefix and the first character after the colon are case-insensitive (so uSeR:archAngeL links to User:Archangel).

In link targets, spaces and underscores (which are effectively equivalent) are ignored if they come at the start, at the end, or immediately before or after the colon following a namespace prefix. Consecutive spaces / underscores are treated as a single space.

HTML character references and percent-encoded characters are replaced with their raw character. For example, [[d&eacute;partement]] produces département, and [[%40]] produces @.

Notes and references