2

I've tried searching and read the Questions that may already have your answer list, but couldn't find an answer.

This is about a category page that lists products in it, you click one and go to the actual product page (not sure if there's a common term for that kind of pages). I worked with a person some time ago who claimed that it's better to, where possible, wrap the thumbnails and item names with one common parent anchor <a> tag.

Here's an example:

<a href="/product1">
    <img src="/product1.jpg" alt="Product One">
    <h4>Product One</h4>
</a>

vs. the traditional

<a href="/product1">
    <img src="/product1.jpg" alt="Product One">
</a>
<h4>
    <a href="/product1">Product One</a>
</h4>

Let's say we can style them both equally and there's no difference from that perspective, what would be better for SEO?

  • Both are valid... it comes down to what one you prefer and makes sense. If the elements related to the resulting page then it is completely acceptable to wrap those elements in a <a> element... this was written in HTML5 spec several years back. – Simon Hayter Dec 26 '16 at 20:53
1

When there's no anchor text, most crawlers default to looking at the image's alt tags for a description.

If you're not using alt tags, I would imagine most crawlers default to scraping just the anchor text.

  • We are using the alt tags, thanks, edited my quesiton – aexl Dec 22 '16 at 12:50
0

i would say, use the second variant. The first variant sends mixed signals from a title, img alt and h4. The clearest variant would be:

<section id="p1" class="div p">

<h4 class="h4 p">Product One</h4>

<img class="img p" src="/product1.jpg" alt="Product One">

<a class="a p" href="/product1" title="Product One">Product One</a>

</section>

In this variant you send pure signals from all of three entities: heading, image and link

  • 1
    There is absolutely nothing wrong with using headers, images and so forth within a <a> element. If the header and image are related to the link then they are completely valid... Google will associate both with page content and the resulting path, also Title does not clash with Alt... its a completely different attribute. – Simon Hayter Dec 26 '16 at 20:52
  • it is not about right, wrong, valid or non-valid, it is rather about more or less clear. – Evgeniy Dec 26 '16 at 22:20
  • More clear about what?... markup has little to no real role in rankings. Page signals are established from a vast amount of actual real page content not the elements themself... elements MAY help Google and other search engines understand the content, nothing more... Google can make sense of content with or without elements. That's how you sometimes see TXT, PDF and other formats in the search results which have no HTML markup. The correct method is to use the method that users will want... and not the search engines. – Simon Hayter Dec 27 '16 at 11:51
  • So in most cases... in both SEO and from a UX stand point... elements within <a> trumps multiple a, or singular a. – Simon Hayter Dec 27 '16 at 12:00
  • Clear about meaning. Like in any language you can write like Kafka or like Hemingway. You don't know for sure, whether the markup elements themself and, specially, their order do play a role, it is better to code clear – Evgeniy Dec 27 '16 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.