Template:Anchor

From AnthroWiki
Revision as of 09:15, 22 February 2021 by Odyssee (talk | contribs) (Created page with "<includeonly><span style="visibility:hidden" id="{{{1|{{{anchor|anchor}}}}}}"><span id="Anker:{{{1|{{{anchor|anchor}}}}}}"></span></span></includeonly><noinclude> {{Documentat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<templatestyles src="Module:Documentation/styles.css"></templatestyles>

Template documentation[view] [edit] [history] [purge]

Description

Needed is a specific link to a section of an article in AnthroWiki. The Template Anchor offers this possibility without having to link to a heading. This allows speaking section names to be created where a heading is not appropriate or cannot be worded as succinctly as would be desirable for the link.

Documentation

The {{anchor}} template expects a parameter after the |, the name of which can be freely chosen:

{{Anchor|bar}}
creates an anchor in the article foo. This can then be linked with
[[foo#bar]]
.

Alternative names for headings

If the anchor is to provide an alternative name for an existing heading, the best place to include the template is not before the heading, but on the same line:

=={{Anker|Name1}}{{Anker|Name2}}{{Anker|Name3}}Überschrift==

This way, when editing, the anchors will be visible even if only the section is edited.

Wrong application

The application within headings in the form.

== {{Anchor|Bar}} Bar ==

(i. i.e. Same text in both template and heading itself) is superfluous and should be avoided: The heading

== Bar ==

automatically generates an anchor with the id 'Bar'. When the template is applied, this id is assigned twice, which leads to invalid w:HTML and can cause inconsistencies in the navigation and CSS formatting.

For the same reason, template embeddings with a value identical to an already existing heading are not allowed.

Examples

In Alsfeld, the chapter Buildings in which the town hall is mentioned should be linked.

1. insert the anchor building block in the heading of the buildings:

== Buildings {{Anchor|City Hall}} ===
. 2. now you can link
[[Alsfeld#Town Hall|Town Hall Alsfeld]]
, it looks like this: Town Hall Alsfeld