Template:Ha/doc

From Angelina Jordan Wiki
Revision as of 13:00, 4 December 2025 by Dcljr (talk | contribs) (doc created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
This is a subpage documenting Template:Ha. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

This template creates one or more "hidden anchors" that can serve as targets for incoming links, or for links within the same page (like section headings do). More specifically, it generates code like <span id="…"></span>. Because of this, nothing is actually displayed on the page as a result of a call to this template. If you want an anchor to be tied to visible text, use {{anchor}} instead.

The name of this template is based on the phrase "hidden anchor(s)".

Usage

  • {{ha|anchor name 1|anchor name 2|}}

Up to 5 anchor names can be specified.

Examples

  • {{ha|Anchor}}
  • {{ha|Anchor|Link target|Another Possibility}}

As explained above, there is no visible output. But the anchor formed by the first example can be targeted by links of the form [[#Anchor]] on the same page or [[Page Name#Anchor]] on other pages (assuming the page on which the {{ha}} link is placed is titled "Page Name"). The second example is similar, but the links can use "Anchor", "Link target", or "Another Possibility". They all end up at the same place on the page.

Alternate section titles

Note that if you want to place hidden anchors within a section heading (perhaps because the section is being renamed, but you want incoming links using the old section name(s) to still work), you will have to substitute the template, like this:

=={{subst:ha|First|Second}} Third ==

If subst: is not used, the page history gets polluted with weird looking entries, like

(cur | prev) ○ 12:17, 4 December 2025 Username (talk | contribs) (6,208 bytes) (+20) . . (→{{ha|First|Second}} Third: changed some things) (undo)

where the link after the arrow, which should lead to the "Third" section on the page, doesn't do that (because the {{ha}} template-call code messes things up).

The preferred method for supporting alternate section titles is to place the anchors immediately below the section heading, like this:

== Third ==
{{ha|First|Second}}

The downside to doing it this way is that many readers following a link to one of the alternate anchors will end up at the right place on the page but with the "Third" section title just out of view, above the top of their browser window. This doesn't happen to logged-in users using the Vector-2022 skin; they will see the section title (unless that depends on what browser they're using — it works in Firefox, anyway).

See also

  • {{a}} – non-hidden anchor
  • {{da}} – date anchor