DEV Community

Burdette Lamar
Burdette Lamar

Posted on

TIL: Adding a Wikipedia Anchor (Link Target)

Today I learned how to add an anchor (link target) to a Wikipedia article.

tl;dr? -- Cut to The Chase

Why do I want to do this? I write documentation over at Ruby (hundreds of commits there, I'm proud to say). I often link to technical details on Wikipedia, to avoid "re-writing the wheel" (if you'll pardon the mixed metaphor).

Recently I wanted to link into (but not to the beginning of) a long section. The section's header is a link target, but that's it.

The section is here and the part I wanted to link to (but could not) is the first item (GET) in a data list therein. Now I can!

This is because I added an anchor there: {{anchor|GET method}}, which means that I can link with https://en.wikipedia.org/w/index.php?title=Hypertext_Transfer_Protocol#GET_method (as above).

The Chase

Anyone can add an anchor to a Wikipedia article:

  • The form is {{anchor|Foo}}, where Foo is the anchor name.
  • The link should be the article's url, with #Foo suffixed.

The change can be reverted by a monitor there, but the anchor is invisible, so there would not be much reason for that).

Top comments (0)