Bug Report

(Request) Named section links [#1686]

Back to forum

New reply

HermanHiddema: (Request) Named section links (2009-01-05 14:23) [#5527]

Currently, if you want to link to a section within another page, you can do it with a #tocX link. For example, linking to DoubleKo#toc2 leads to the section about "Seki in double ko".

This can be useful, because that way, in another discussion you can say something like:

Now black makes Seki in double ko (note where that link goes).

If, however, someone adds a section to the double ko article above this one, the #toc2 link will break (it it now #toc3). If instead, such links would lead to named sections, that problem would not occur. So I would like to be able to link to something like DoubleKo#SekiInDoubleKo, where the section title has been turned into a valid page name (ie: stripping spaces and punctuation) and then used as the content of the <a name=""> element.

This new way is still vulnerable to breaking if someone changes the section title, but i think that is less likely to happen than the addition of new section (or a reorganization of the current ones). And also, if you link to a section, you can leave a note there on in a comment line (starting with %) which goes something like:

% This section is linked to directly, please do not change the section title
HermanHiddema: alternative solution (2009-01-12 19:01) [#5628]

As an alternative, how about a special template that allows you to add an anchor to the page?

EG, something like: {{anchor|StraightJGroup}} in the J Groups page, which would insert an <a name="StraightJGroup"> into the page, and which allows the same result as the current J-Groups#4, but without any content generated.

Also important in this case would be to allow Aliases to point to anchors, so we could alias StraightJGroup to !Jgroups#StraightJGroup (or is this possible already?)

ArnoHollosi: Re: alternative solution (2009-04-27 17:40) [#5987]


I liked the template idea, so I have implemented it. See SpecialTemplates/Anchor.

Having aliases with anchors does not really work:

  • currently aliases do not redirect users to the canonical URL
  • even if they did, the HTTP protocol does not specify how clients should handle URL fragments. And, as you can guess, browsers handle fragments in redirects differently.
HermanHiddema: Re: alternative solution (2009-04-27 19:30) [#5989]

Ok, thank you very much, very useful!

Back to forum

New reply

[Welcome to Sensei's Library!]
Search position
Page history
Latest page diff
Partner sites:
Go Teaching Ladder
Login / Prefs
Sensei's Library