Anchor links to another page* frustrating*

Permalink
OK. I know this has been spoken about before and I have read the posts.

But is there a way to make this work?

I have:

<code>

<ul>
<li><a title="Forest Tree" href="http://dev.touch-akl.com/talltrees/index.php?cID=58#FD">Forest Development</a></li>

</code>

with my ...#FD anchor in place on my home page.

Then on the next page I have a long page with anchors next to all the h2 headings like so:

<code>
<h2><a name="FD"></a>Forest Development</h2>
<p>Duis autem vel eum iriure dolor in ...</p>

But this isn't working at all.

Has anybody managed to make this work by hook or by crook, because I would like to know...

I have managed to make this work on three pages but there is one page that is doing my head in. It just won't work. It is the first link in the nav and I have tried everything.

Such a simple thing is driving me nuts...

Nige

nige
View Replies:
s2d replied on at Permalink Reply
s2d
I can certainly sympathize, Nige... those little things you've done a hundred times and expected to take 5 minutes to do can sometimes end up eating your lunch!

I can't see precisely what the problem is, but maybe a few questions will help narrow things down a bit. When you say is doesn't work, does it just do nothing when you click on it, or does it go to the other page, but not to where the anchor is?

Your code looks exactly like the code I have from working examples from a couple of my sites:

The hyperlink:
<p><a title="Hospitals and Specialists" href="http://rotarysunshineproject.org/content/index.php?cID=67#hospitals">Hospitals and Specialists</a></p>


The anchor:
<p><a name="hospitals"></a> ...text content... </p>


The only difference I can see is that your hyperlink is in a list item, which shouldn't make any difference, but maybe one thing you can try just for kicks is to move your hyperlink to other locations in your page and see if you notice any change in the behavior of the hyperlink. If not, that's one more thing you've ruled out. If you do notice a change, maybe the problem is with the context of the hyperlink, rather than the hyperlink itself.


Kate
agedman replied on at Permalink Reply
agedman
When you hover over that link does it show correctly something like:http://dev.touch-akl.com/talltrees/bigpage/#FD... ?

Maybe try clearing the cache (server and browser) if you haven't already... And just to be sure, you could run your page through an HTML validator.
nige replied on at Permalink Reply 1 Attachment
nige
Site is here and thanks for your help –

http://dev.touch-akl.com/talltrees/...

The really frustrating thing is that from four columns of links three columns work correctly. Its the first column that doesn't (see image)

I have tried to eliminate the potential problems but the code is identical. The other column anchors move the page as much as the length of the page allows which is correct, while this first column the links do work, they go to the page, but the anchors just don't work. The page loads exactly the same top to bottom each time.

When I hover over the link it shows the alt tag. It would be helpful to show the link. I suppose I could firebug that.

I appreciate your help on such a frustrating time wasting thing.

Nige
Fernandos replied on at Permalink Reply
Fernandos
hi!

I'd check for unclosed tags first. If I were you. You've 22 Errors on your page and 1 Warning!


Click this link to verify and fix the bugs.
Your question is unrelated to concrete5 itself, it's more a basic html question.

http://validator.w3.org/check?uri=http%3A%2F%2Fdev.touch-akl.com%2F...
nige replied on at Permalink Reply
nige
oh oops, OK I'll do that...

Thanks for checking that btw...

I've just checked it and I can't make sense of it mainly because it says there are mistakes that aren't there.

There are no unclosed tags for instance or styles used in the head or end tags omitted. I always fond this validator gives me a headache.

Nevertheless thanks for trying I'm going through everything with a fine tooth comb now...
Shotster replied on at Permalink Reply
Shotster
nige,

A cursory look at your site reveals that the links in the first column don't appear to be the canonical URLs. In other words, when I click the link that says...

http://dev.touch-akl.com/talltrees/index.php/forest-tree/#forestdev...

...it redirects to...

http://dev.touch-akl.com/talltrees/index.php/what-we-do/forest-tree...

The links in the other columns appear to be the canonical URL. I would therefore change the links in the first column thusly...

http://dev.touch-akl.com/talltrees/index.php/what-we-do/forest-tree...


Hope that makes sense,

-Steve
nige replied on at Permalink Reply 1 Attachment
nige
Yes Steve, thanks for replying and just as I saw your email I discovered that it is an url problem. I have noticed (see shot) that under properties there was an additional page url.

I don't know why, perhaps because there is a redirect to 1st link in nav above this page.

Anyway I removed this additional url and all is working.

I have learn't how to troubleshoot this sort of thing much better so thanks for everyones help!

Nige
Shotster replied on at Permalink Reply
Shotster
Strictly speaking, I suppose this could be considered a bug (or at the very least an oversight) in C5. When accessing a page from anything but the canonical URL, it apparently doesn't parse the URL looking for the hash symbol. Instead, it just ignores it and throws it away before redirecting. C5 could certainly be smarter and preserve any anchors appearing in the URL.

I think it's worthy of a bug report if you want to take the time to do so.

-Steve
nige replied on at Permalink Reply
nige
I'm not sure about that because my technical knowledge is limited and I don't really understand why it's a bug.

I understand what your saying but why c5 is doing it I don't.

I mean was it my fault there was an extra url in the Additional Page Urls section.

I didn't put it there it was an automatic thing. Why?

Nevermind I prefer to have a few more facts before I cry BUG!

(Its a swear word around here)...

Thanks for the help :-)
Shotster replied on at Permalink Reply
Shotster
Here's what I suspect happened...

The forest-tree page was initially created under the home page. At that point its canonical URL was "/forest-tree". Then it was later moved underneath the "/what-we-do" page. When that happened, the canonical URL became "/what-we-do/forest-tree" and C5 automatically changed the original "/forest-tree" URL into an "additional" URL.

In other words, C5 did the sensible thing of enabling the previous URL to continue to work. If C5 didn't do that, then if someone had bookmarked the page at its original URL, that URL would no longer work after the page was moved.

By way of overview... In C5, each page has only one canonical URL, but you can create as many "additional" URLs as you'd like. (I do it all the time.) In the case of restructuring the page hierarchy (reorganizing the site map), C5 automatically creates an additional URL for you so that the page continues to be accessible from its previous URL[s]. (A page accessed from an "additional" URL causes [by design] a redirect to the canonical URL. It just so happens that C5 is ignoring anchors in additional URLs.)

Therefore, I maintain that the behavior you encountered - i.e. C5 ignoring anchors in "additional" URLs - is in fact a bug. The good news is that it's probably simple to fix.

I'll go ahead an submit a bug report on it.

-Steve
nige replied on at Permalink Reply
nige
you just explained it perfectly and I understand exactly.

Yes it is a bug... brilliant.

Nige
spenderg replied on at Permalink Reply
Has anyone discovered a workaround to this? I'm using C5 5.5.1 and apparently this is still not fixed. Anchor tags -- a fundamental component of most websites. My users are annoyed to say the least, and I don't blame them. I've tried switching from pretty/non-pretty urls, but nothing seems to help. I can manually type the anchor into the browser address and the anchor works; but doesn't work if I just click on the anchored link within the page.

UPDATE: when editing my block/content, I've edited the HTML directory so that instead of the code the C5 auto creates for anchors, e.g.

href="#foo"

I changed it to

href="./#foo" and that worked.