WordPressag真人在线投注无问鼎下载入口苹果iOS官方版-问鼎下载入口苹果插件外部链接自动添加nofollow标签
有时内容会引用或分享一些外部链接地址,严格要求的话是需要在外部链接全部加上nofollow标签。
在wordpress写文章时,当然目前一些wordpag真人在线投注ress主题设置有这个nofollow标签功能。问鼎下载入口苹果iOS官方版-问鼎下载入口苹果
//文章自动nofollowadd_filter( 'the_content', 'tin_seo_wl');function tin_seo_wl( $content ) { $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>"; if(preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) { if( !empty($matches) ) { $srcUrl = get_option('siteurl'); for ($i=0; $i < count($matches); $i++) { $tag = $matches[$i][0]; $tag2 = $matches[$i][0]; $url = $matches[$i][0]; $noFollow = ''; $pattern = '/target\s*=\s*"\s*_blank\s*"/'; preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE); if( count($match) < 1 ) $noFollow .= ' target="_blank" '; $pattern = '/rel\s*=\s*"\s*[n|d]ofollow\s*"/'; preg_match($pattern, $tag2, $match, PREG_OFFSET_CAPTURE); if( count($match) < 1 ) $noFollow .= ' rel="nofollow" '; $pos = strpos($url,$srcUrl); if ($pos === false) { $tag = rtrim ($tag,'>'); $tag .= $noFollow.'>'; $content = str_replace($tag2,$tag,$content); } } } } $content = str_replace(']]>', ']]>', $content); return $content;}
添加到当前主题Funcions.php 文件中,可以直接找一些wordpress插件安装。当然我们也可以通过代码实现无插件添加方法。这样所有的外部链接就会自动加上nofollow标签。ag真人在线投注>问鼎下载入口苹果iOS官方版-问鼎下载入口苹果如果手动每个链接加入是很麻烦,有些外部链接是没有加Nofollow标签,在技术层面是有传递出去权重。
- 最近发表
- 随机阅读
-
- 阿里云虚拟主机SSL证书部署(https配置)
- 飞牛fnOS系统虚拟机迎来v0.9.0更新,新增安装镜像支持,从此告别繁琐安装
- wordpress网站标题文章如何批量修改
- dedecms织梦网站模板源码图文安装教程
- 大旗发帖助手下载/使用教程
- 织梦dedecms文章内容如何批量替换
- dedecms漂亮美女图片网站模板v1.1
- wordpress评论者链接在新窗口打开
- 知麻Z2 MINI投影仪限时特价!秒杀价仅需764.15元,真香!
- 宝塔面板MySQL数据库自动重启设置
- 织梦dedecms修改文章,时间不变的方法
- WordPress动漫图片主题cxudy0.2下载
- WordPress多功能免费主题Git(乐趣公园)下载
- 个人网站文章撰写建议及规范
- dedecms织梦5.7仿站视频教程(初级下部)
- WordPress网站外链添加GO跳转提示代码
- dedecms实现tag标签伪静态方法
- 经典90版html坦克大战小游戏代码
- dedecms实现tag标签伪静态方法
- (扒站工具)如何下载网站fonts文件夹
- 搜索
-
- 友情链接
-