WordPress无征途国际下载链接插件外部链接自动添加nofollow标签
这样所有的外部链接就会自动加上nofollow标签。
在wordpress写文章时,严格要求的话是需要在外部链接全部加上nofollow标签。如果手动征途国际下载链接每个链接加入是很麻烦,当然目前一些wordpress主题设置有这个nofollow标签功能。可以直接找一些wordpress插件安装。
//文章自动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 文件中,在技术征途国际下载链接层面是有传递出去权重。有些外部链接是没有加Nofollow标签,有时内容会引用或分享一些外部链接地址,当然我们也可以通过代码实现无插件添加方法。
- 最近发表
- 随机阅读
-
- wordpress博客纯代码去掉分类目录Category
- Instagram APP是什么软件
- 搜索引擎的工作原理(一)
- web前端盒子模型box model属性
- dedecms仿站之index.htm(主页模板)标签介绍
- wordpress插件Bing URL Submissions网址自动提交到必应
- 个人网站程序语言HTML/ASP/PHP解析
- WordPress主题安装style.css样式表未包含合法的主题
- JavaScript什么是正则表达式var
- DedeCMS织梦从入门到精通建站(仿站)视频教程全集
- 小米户外摄像头大升级:500万像素3K画质,高清看得见,199元带回家
- (扒站工具)如何下载网站fonts文件夹
- 爱奇艺qsv/腾讯视频qlv/优酷视频kux格式转换MP4
- html5 3D旋转木马幻灯片播放代码素材
- 8款CSS3鼠标滑过图片动画特效代码
- dedecms织梦5.7仿站视频教程(中级下部)
- javascript数据类型(typeof操作符)
- 传统企业SEO如何关键词精准定位
- 打破国际垄断!碧水源推动医药膜国产化替代
- CSS3渐变效果linear
- 搜索
-
- 友情链接
-