多个单独的 rel= 标签属性可以吗? (WordPress)
a 标签中有两个单独的 rel="" 属性可以吗?
WordPress 默认情况下似乎为所有外部链接添加了 rel="nofollow" 标签。在代码中,它们被添加到 a 标记的最开头。
为了将 rel="me" 属性添加到我的“关于”页面上的社交个人资料(我的 rel="author" 链接指向的位置),我添加了一些 按照 Yoast 的建议进行调整。
生成的代码如下所示:
<a rel="nofollow" title="XYZ" href="http://link.com" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://link.com']);" rel="me nofollow">Google Profile</a><br />
注意开头的 rel="nofollow",然后是 a 标记末尾的 rel="me nofollow"。最后的属性是手工编码的,第一个属性是 WordPress 默认的。
有两个 rel="" 实例可以接受吗?如果是这样,我应该删除第二个中重复的 nofollow 属性吗?
不过,通过 Google 的 SGAPI 重新抓取工具检查后,我没有看到我的博客正确链接到我的 Google 个人资料这些属性似乎已被 Rich Snippets 测试工具拾取。
Is having two separate rel="" attributes in an a tag OK?
It seems WordPress by default adds a rel="nofollow" tag to all external links. In the code these are added to the very beginning of the a tag.
In order to add rel="me" attributes to my social profiles on my About page (where my rel="author" links point to), I've added some tweaks as suggested by Yoast.
The resulting code looks as follows:
<a rel="nofollow" title="XYZ" href="http://link.com" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','http://link.com']);" rel="me nofollow">Google Profile</a><br />
Note the rel="nofollow" at the beginning, and then the rel="me nofollow" towards the end of the a tag. The attributes at the end are hand-coded, the initial one is the WordPress default.
Is having two instances of rel="" acceptable? If so, should I get rid of the duplicate nofollow attribute in the second one?
I'm not seeing my blog properly linked to my Google Profile, checked via Google's SGAPI Recrawl Tool, however the attributes seem to have been picked up by the Rich Snippets testing tool.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
You can use the w3c Validator tool to tell whether html is valid. Duplicate attribute names are invalid html. Get rid of the first one and just use your second tag.