I wanted to use the nifty square-bracket links to point someone to a particular named anchor in a document (the hash-mark part of the URL: #fragment), so I did this: [perlman:perltie#Tying_Hashes|tying a hash]but the resulting page had a link with the fragment indicator in the wrong spot, like this: tying a hash, which of course results in a "Not found" when you click on it.

After poking around a while, I settled for just referring to the whole page.

So do I have to use a regular anchor-and-href link if I want a fragment in the URL?

I couldn't find anything about this -- positive or negative -- in the site docs. If it's there and I missed it, please point out how you found it. (Don't give me a fish, help me to fish for myself in the future. ;-)

Replies are listed 'Best First'.
(tye)Re: Fragments in inter-node links?
by tye (Sage) on Jul 01, 2001 at 23:55 UTC

    Ah, a perfect opportunity for me to complain about one of my many pet peeves: intra-site links that mention "http://www.perlmonks."

    There are several ways you could make such a link:

    • If you type [http://www.perlmonks.net/index.pl?node=perlman%3Aperltie#Tying_Hashes|http in brackets] you get http in brackets

    • If you type <a href="http://www.perlmonks.net/index.pl?node=perlman%3Aperltie#Tying_Hashes">http in HTML link</a> you get http in HTML link

    • If you type <a href="/?node=perlman%3Aperltie#Tying_Hashes">site-relative HTML link</a> you get site-relative HTML link

    • If you type <a href="?node=perlman%3Aperltie#Tying_Hashes">relative HTML link</a> you get relative HTML link
    Only the last one is acceptable to me as the first two can redirect someone from www.perlmonks.ORG to www.perlmonks.NET (for example), where they may not have a cookie (or might have a different cookie) and so will suddenly find themselves not logged in (for example). (update) The third one could take someone from perlmonks.org/wap/index.pl to perlmonks.org/index.pl and so should be avoided (although PerlMonks itself is still very guilty of this sin and so the "wap" directory doesn't even exist yet, but such features are planned and hoped for).

    Note also that the "index.pl" is optional in the URL (I've left it out of the last two but not the first two).

            - tye (but my friends call me "Tye")
Re: Fragments in inter-node links?
by chromatic (Archbishop) on Jul 01, 2001 at 23:38 UTC
    It's not supported in any version of Everything I've ever seen. I've considered adding internal support for namespaced links ([E2://chromatic|me on E2]), named anchors wouldn't be too terribly difficult, unless people used the octothorpe in node names...