WordPress无真人ag平台开户插kai云体育网页登录入口件外部链接自动添加nofollow标签
当然目前一些wordpress主题设置有这个nofollow标签功能。
//文章自动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 文件中,在技术层面是有传递出去权重。当然我们也可以通过代码实现无插件添加方法。有时内容会kai云体育网页登录入口trong>真人ag平台开户引用或分享一些外部链接地址,可以直接找一些wordpress插件安装。
在wordpress写文章时,这样所有的外部链接就会自动加上nofollow标签。
- 最近发表
- 随机阅读
-
- 影响爬虫抓取网页的因素
- WordPress多功能新闻积分商城主题LensNews2.2
- wordpress/帝国cms配置https(SSL)无法登录后台
- wordpress网站隐藏内容付费阅读/下载插件foxpay
- wordpress博客内容代码/字符自动转义问题
- wordpress时光轴自适应主题jinsomB模板
- javascript数据类型
- CSS边框border样式属性设置
- 个人网站阿里云IPC备案10天办理完成
- wordpress网站诊断提升打开速度
- html5简洁瀑布流布局网页模板
- 爱奇艺qsv/腾讯视频qlv/优酷视频kux格式转换MP4
- CSS3浏览器前缀和长度单位rem
- javascript位运算符与赋值运算符
- SEO网站编辑文章如何伪原创
- CSS3变形效果transform
- 爱奇艺qsv/腾讯视频qlv/优酷视频kux格式转换MP4
- dedecms织梦5.7仿站视频教程(中级上部)
- wordpress博客网站访问速度慢因素
- 搜索引擎的工作原理(一)
- 搜索
-
- 友情链接
-