I have an index page with a list of articles that each should link to their corresponding article page. However in the title of each article there can also be hashtags (similar to twitter/instagram hashtags) that should be separately clickable.
I know HTML5 does not allow links inside links, or any interaction for that matter. I also know Google much prefers a shorter explanatory link text above a block link full of elements.
What would be the best way to handle this, keeping valid HTML5 and also with SEO in mind.
so to briefly put in code:
<article>
<a href="/link_to_article">
<h1>Title of article <a href="/search/#hashtag">hashtag</a></h1>
<p>Some brief text</p>
</a>
</article>
Perhaps I should reside to javascript for the block-level link? Interested to hear your opinion.
2
Answers
Because of writing valid code, I would recommend use of javascript onclick param. Something like onclick=”location.href=’/link.html'” on the outer div wrap. Don’t wrap block elements like h1, p, div, … with an inline element/a-tag.
Just make them separate links.