Memory Alpha

Visible anchor/doc

Template page | < Template:Visible anchor

39,338pages on
this wiki


{{Visible anchor}} or its plural alias {{Visible anchors}} will insert one or more HTML anchors in a page at the location of its invocation, enabling direct #Links to this location. Unlike {{Anchor}} and {{Anchors}}, the first parameter will be visible text on the page. See the "Usage details" section for an example.


After that, you can have links sending directly to the line you marked:

  • With [[#Bar & Baz|link label]]
  • With [[Article name#Bar & Baz|link label]]

Usage detailsEdit

Before{{Visible anchors|Foo|Bar & Baz|Three}}After

Notes Edit

  • The template will handle up to ten anchor names, but could very easily be extended to do twice or more. If you accidentally use more than ten anchors, the template will output an error message in a red box like this:
     Template:Visible anchor: too many anchors!
    1 This will let you know about it instead of having your extra anchors silently ignored.
  • When used to add anchors to a paragraph of prose, it is preferable to put the template at the very start of the paragraph (stuck to the first word, without space) so as to ensure that incoming #Links will result in the full paragraph being displayed on the reader's screen.
  • Though aliases {{Visible anchor}} and {{Visible anchors}} will work interchangeably, it is preferable to use the singular alias for a single anchor, and the plural alias for multiple anchors. This will allow Special:WhatLinksHere/Template:Visible anchors to track usage of multiple anchors, and could help detecting and converting old-style {{Visible anchor|Foo}}{{Visible anchor|Bar}} to {{Visible anchors|Foo|Bar}}. So for maintenance needs, we'd appreciate you maintain the suggested convention.

Known bugEdit

  • Currently, the anchor code is included in a section-edit summary. For instance, section-editing the "Notes" section of this page will pre-fill your edit summary with:
/* Notes {{Visible anchors|Notes|Details}} */
This is inconsequential for your edit, but can be inconvenient for your edit summary when there are many long anchor names. You can however edit it out to just:
/* Notes */... your normal thorough edit summary
This bug can't be helped in the template itself. It is hoped, not promised, that a future version of the MediaWiki software will skip template calls in headings for section-edit summaries.

Anchor namesEdit

  • Due to technical limitations, anchor names can not include the characters "#" (hash), "|" (pipe) or "=" (equal). On the other hand, special characters such as " " (space), "," (comma), "&" (ampersand), etc. can be used directly both in anchors and links, because the software will process them automatically into a URL-compatible format.
  • Anchor names should preferably be written in "Sentence case" (as is the standard for headings and thus their anchors); that is, capitalize the first letter of the first word and any proper nouns, but leave the rest lowercase. Examples: "The title of my anchor", "The anchor from Ipanema", etc. Because some browsers have case-sensitive anchors, the anchor name used in a #Link should be absolutely identical to its target (rather than all-lowercase).
  • Anchor names should be unique (with respect to all heading titles and additional anchors) on each page; a duplicate anchor won't work since the #Links will always go to the first homonymous anchor on the page.


  • The template is based on <span id="anchor"></span>.
  • The more backward-compatible <a name="anchor" id="anchor"></a> is used by Memory Alpha's own headings but disabled for editors in the wikicode and thus not used here.

See alsoEdit

Around Wikia's network

Random Wiki