WordPress评论链接函数 comments_popup_link() 会在链接处生产
文章链接#comments
这样的链接,#comments
是指向文章页面评论模块的意思,但是搜索引擎会抓取到 文章链接 与 文章链接#comments 视为同一篇文章多个链接,对 SEO 不是很友好。
给 WordPress 评论链接加上 nofollow 的方法就是在 WordPress主题 functions.php 文件中加入:
function add_nofollow_to_comments_popup_link(){ return ' rel="nofollow" '; } add_filter('comments_popup_link_attributes', 'add_nofollow_to_comments_popup_link');