问题原文
原帖链接 · Clément Jacquelin · CC BY-SA 3.0
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>
已采纳解答
原帖链接 · Kristian Svensson · CC BY-SA 3.0
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:
- Make sure your CSS + JS files are not blocked for Google and other search engines e.g. in your robots.txt.
- 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
