WordPres真人庄闲游戏平台s无pc28加拿大开奖结果预测官网插件外部链接自动添加nofollow标签
这样所有的外部链接就会自动加上nofollow标签。严格要求的话是需要在外部链接全部加上nofollow标签。当然目前一些wordpress主题设置有这个nofollow标签功能。有时内容会引用或分享一些外部链接地址,有些外部链接是没有加Nofo真人庄闲游戏平台llow标签,pc28加拿大开奖结果预测官网
在wordpress写文章时,在技术层面是有传递出去权重。如果手动每个真人庄闲游戏平台链接加入是很麻烦,pc28加拿大开奖结果预测官网可以直接找一些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 文件中,当然我们也可以通过代码实现无插件添加方法。
- 最近发表
- 随机阅读
-
- 烟雨开源图床系统源码v2.1下载
- 影响爬虫抓取网页的因素
- javascript一元运算符与算术运算符
- 全站死链接检查工具Xenu下载
- 新浪微博主页侧边栏跟随页面滚动代码
- Adobe Dreamweaver cc 2018中文版本
- wordpress提示function.call
- wordpress网站防复制插件CopyRights下载
- CSS盒模型display行内块元素/float浮动
- 个人网站/公司logo标志免费在线制作
- wordpress博客头部wp
- fiddler2抓包工具中文汉化版下载
- Crypto Markets Add $70 Billion Daily as Bitcoin (BTC) Soars Past $71K (Market Watch)
- B站视频下载软件工具推荐
- HTML5表单元select(三)
- 织梦include\ckeditor\ckeditor
- 图片/书本的文字如何快速提取(复制)?
- WordPress图片主题Lovephoto2.0.2分享
- 小米米家折叠偏光太阳镜:轻薄时尚,价格亲民,你值得拥有!
- wordpress网站登录出现500Internal Server Error
- 搜索
-
- 友情链接
-