我在html中用于显示图标字体图标的文字出现在Google搜索结果中。我该如何阻止这种情况的发生?
我已经添加了area-hidden
和role='img'
,但是这些似乎没有任何影响。
<span class="material-icons" aria-hidden="true" role="img">search</span>
我在网上环顾四周,大部分发现的信息是有关如何为可访问性目的而进行改进的,而不是关于如何将其隐藏在googlebot中的信息。
基于下面的@jake回答,我进行了以下尝试。
HTML
<span class="material-icons" aria-hidden="true" role="img" data-icon="search"></span>
CSS
.material-icons::after{
content: attr(data-icon);
}
答案 0 :(得分:1)
此question提供了伪元素形式的答案。
在这个github线程上,他们建议使用字体代码点:
https://github.com/google/material-design-icons/issues/498
检查代码点和图标之间的mapping。