I'm designing a WordPress post template where I have more than one section on the page each section has a picture as it's main heading.
my question here is what is the best practice to implement this without affecting SEO since I'm replacing the H2 tag with an image?
I'm considering doing one of these solutions
<h2><img src="---" alt="the second section title"></h2>
or like this
<h2 style="display:none">the second section title</h2> <img src="---" alt="the second section title">
which one is better? and is their any better solution to approach this?
the first option seems to be better since Alt text does not count as "hidden text" if it accurately describes the image, which is that in my case.
as for the second option it's not suggested since it might violate google hidden text and links guidelines and it's semantically incorrect since it will be considered part of the section content while the image represent the section title.