Browsers don't see target in site map

Hi - I generated my site map at www.xml-sitemaps.com. Saved the sitemap.html, went into it and added the target

<a name=“shop”></a>

above the shop area

The browsers don’t see it, so that:

http://www.greensmoothie.com/sitemap.html#shop

will take you to the top of sitemap and not to the top of shop/ within sitemap.

When I view source, I can see the target is there. Does anyone perhaps know why browsers don’t see it?

thanks for your kind help - Val

As a link, http://mypage.html#shop (for example) will go to mypage.html and then look for an element on that page with an ID of #shop. If it doesn’t find one, it will just go to the top of the page. So you have to add such an ID to the relevant element. E.g.

<div[COLOR="Red"] id="shop" [/COLOR]class="lhead">shop/<span class="lcount">13 pages</span></div>

You need to put the tag inside a table cell.
(Actually, what you need to do is to ditch the table layout and join the 21st century, but we’ll leave that to one side for the moment)

If you had typed some random text at the point where you put <a name=“shop”></a>, it would have appeared above the table, because that’s what happens to text between the start <table> and end </table> but isn’t in a content-containing element, ie a <td> or <th>. It’s exactly the same with the anchor - because it isn’t legally placed inside a table cell, it bobs up to sit on top of the table.

Of course, it’s much better to put id=“shop” on the element you want to jump to rather than messing around with named anchors anyway, and that would solve the problem even more easily.

A couple of other tips:

  1. You don’t need any of those class="lpage"s, you can achieve the effect better with child selectors.
  2. Take out http://www.greensmoothie.com from every link, it’s completely unnecessary.
  3. Only use a title attribute on a link when it adds something extra. If all you’re doing is repeating the text that is visible (or at most adding some filler like “Click here to…”) then there’s no point in having the title there, it just adds complications.

HI guys - thank you! - both methods work perfectly so followed your advice + just added "id=“shop” in front of shop/. I learned something new - on rest of site where I’ve updated it to legal markup (deleted all the table’s) I still use the old <a name=“shop”></a> method. So now I’ll have to go into a gazillion pages and change the targets to id=

Remember “I generate my site map at www.xml-sitemaps.com.” I don’t touch the file they generate (it’d be huge waste of my time since I generate it so often) except for that one “shop” target I must add (I link to it from rest of site).

thanks! - Val