Jump to content

Duplicate div / anchor


Recommended Posts

I have used Xenu Link Sleuth to find any broken links and as many errors as I can before we push our site live. I am having a hard time finding / fixing one of the problems that Xenu pointed out.

We have >7,000 products in our store. The error I am trying to find is "

Broken page-local links (also named 'anchors', 'fragment identifiers'):”

The weird thing is that this is only happening on some pages. Not all are product pages, and I can’t seem to find anything that is the same between the specific products that do have it.

There are 18 like this: 

https://www.markwilliams.com/99780.html#product_description anchor occurs multiple times


One of these:

https://www.markwilliams.com/search.html#keywords anchor occurs multiple times


and one of these: 

https://www.markwilliams.com/video.html#sitedoc anchor occurs multiple times

 I can see the duplicate div when I use the FF developer tools, but I can’t figure out how the duplication is happening. Also, if I just leave it, can you think of any potential problems? 

Screen Shot 11-22-17 at 03.19 PM.PNG

Link to comment
Share on other sites

The URL that ends with the fragment identifier #wherever could be pointing to the matching anchor <a name="wherever"> tag. The function of the fragment identifier is to do either of two things:

1. Have the browser scroll the page so that the location in the page where the anchor tag is located will be at the top of the browser viewport.

2. Under javascript control, amongst a set of hidden <div> panels (used extensively in admin), sets the CSS property of the div with that id to display:visible, commonly by clicking a tab control.

In your example above, it seems there are two <div>'s with the same id value. We should try to get that fixed.

Edited by bsmither
Link to comment
Share on other sites

I've been trying to find where this would be coming from, and I have to be missing it somewhere. I am pretty new to JS and PHP.

In content.product.php, lines 49-51, it shows:

<div id="product_description">

However, when looking at the source code, both <div>'s show as product_description. Can you please help me understand where the references are coming from?



Link to comment
Share on other sites

Please remind us what skin you are using.

Certainly, in the template file, there is a div with id="product_description".

Then, there seems to be another div with the same id.

I am going to guess that the product's description content contains that second div.

In admin, Edit that product, view the Description tab. Switch the editor to Source mode.

If I am right, you will see the entire description wrapped in that div. Perhaps someone just copy/pasted some other product's description straight from looking at the HTML source when viewing that other product, and copied too much.

Link to comment
Share on other sites

@bsmither You, Sir, are awesome! You were absolutely correct. I did find that in the HTML of the product descriptions.

We are using a custom skin.

Now, the only error I am left with is:

Broken page-local links (also named 'anchors', 'fragment identifiers'):

https://www.markwilliams.com/search.html#keywords anchor occurs multiple times

I was told that the other person working on this did some modifications to the search, though. So, I will touch base and see if we can figure it out.... If not, I'll be back with more questions.


Thanks again!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...