2

I'm have an accessibility & SEO problem. I want to display more information and punctuation for the people using a screen reader. Will this code will be understand as duplicate content by Google and other search engines?

If yes, what can I do to avoid this behaviour ?

<!-- For screen reader, not visible by user -->

<span class="visually-hidden">
    Place of the event: <?php echo $event->getName() ?>.
</span>


<!-- 
Original content, with condition & no punctuation.
Not visible by screen reader to avoid repetition 
-->

<span aria-hidden="true">
    <?php echo truncate_text($event->getName(), 35) ?>
</span>
2

If you duplicate the text on the same page and change visibility depending on the viewer/screenreader you don't have to worry IF you make sure that search engines are allowed to read your CSS/JS files. Some websites are blocking CSS/JS for bots. That would make the text seem duplicated since Google wouldn't "see" that you are hiding text.

This is what you do:

  1. Make sure your CSS + JS files are not blocked for Google and other search engines e.g. in your robots.txt.
  2. Test the page(s) in Google Search Console. You can fetch the page as Google bot and see how Google will render the page. This is where you can discover if any of your important CSS/JS files are blocked. If you don't have a Search Console account you can get one for free.

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.