WordPress标签默认并无rel=\”nofollow\”属性。rel=\”nofollow\”属性的作用是:告诉搜索引擎,无需追踪目标页,禁止蜘蛛爬行和传递权重。如果你不准备让搜索收录标签,可以通过下面的代码为标签添加该属性。
将下面的代码添加到当前主题functions.php中:
- cx_tags() {
- = get_the_tags();
- () {
- ( ) {
- \'<a = href= rel=>\’.->name.\'</a>\’;
- }
- }
- }
用:
- <?php cx_tags(); ?>
替换主题模板中标签标准函数:
- <?php the_tags(); ?>
当然,你还可以在 rel=后面添加 target=\”_blank\” 实现在新窗口或标签中打开链接。
参考:http://codex.wordpress.org/Function_Reference/get_the_tags
暂无评论内容