Wikia

Memory Alpha

Visible anchor

Discuss0
37,549pages on
this wiki

Template page

The following documentation is transcluded from Template:Visible anchor/doc:

UsageEdit

{{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.

LinkingEdit

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

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

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.

TechnicalEdit

  • 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
http://en.memory-alpha.org/wiki/Template:Visible_anchor
en.memory-alpha.org
crawl=CC-MAIN-2014-42
78334
application/http; msgtype=response
sha1:6WOFNETYFN4SRMV5TWL62PDY2RWFIKR2
<urn:uuid:944a5899-feff-45b7-a07b-8455e99198ba>
2014-10-21T17:26:47Z
23.235.39.131
sha1:7JDXPNHXDY4WW3TGVPZI6BJSPTEVDHQM
<urn:uuid:eaa8bee6-8b40-4b18-9d6f-e92fcffea19b>
http://en.memory-alpha.org/wiki/Template:Visible_anchor
response
<urn:uuid:4313456c-2c44-4e9f-91fd-e177968f4ccc>
robots: classic
hostname: ip-10-16-133-185.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2014-42
operator: CommonCrawl Admin
description: Wide crawl of the web with URLs provided by Blekko for October 2014
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf