Suppose you have a page that displays a large comic image. For the human user, the comic image already contains the text that is to be put in h1 (the title of the comic). UX-wise, displaying this content is unnecessary and disruptive.
(Cutting out a piece of image to display it inside h1 with alt text is not possible because the image should exist as a single entity for the purposes of redistribution.)
What is the semantically correct way to let search engines know about the contents of h1 without compromising user experience?
Option 1 (include but do not display h1):
<article id="todays-comic">
<h1 style="display: none;">Sandwich</h1>
<figure>
<img src="sandwich-comic.jpg" alt="Comic about making a sandwich.">
</figure>
</article>
Problems:
- for a long time has been considered very bad practice SEO-wise,
- there is no way to let the engines know of our good intentions.
Option 2 (hide h1 under image):
<article id="todays-comic" style="position: relative;">
<h1 style="position: absolute; top: 0; z-index: 1;">Sandwich</h1>
<figure>
<img style="position: absolute; top: 0; z-index: 2;" src="sandwich-comic.jpg" alt="Comic about making a sandwich.">
</figure>
</article>
Problems:
- engines can be smart enough to see that h1 is hidden,
- and consider that as a more ill-intentioned way to trick them than "display: none;",
- and there is no way to let the engines know of our good intentions.
Option 3 (put h1 elsewhere and style it):
<article id="todays-comic">
<figure>
<img src="sandwich-comic.jpg" alt="Comic about making a sandwich.">
</figure>
<h1 class="small-and-inconspicuous">Sandwich</h1>
</article>
Problems:
- could still be considered misleading by engines,
- awkward flow (unless structured traditionally but then relocated with flex order, that could still be considered misleading),
- still requires display of unnecessary information.
Option 4 (do not include an h1, add it to alt text):
<article id="todays-comic">
<figure>
<img style="position: absolute; top: 0; z-index: 2;" src="sandwich-comic.jpg" alt="Sandwich. Comic about making a sandwich.">
</figure>
</article>
Problems:
- bad for SEO and semantically lacking: engines no longer understand what the h1 of the section is supposed to be.
Given the situation, what would be the best approach to hiding duplicative h1 content? Are there any better alternatives to these?