WordPre闲闲互娱手游平台ss无征途国际pg官网入口插件外部链接自动添加nofollow标签
有些外部链接是没有加Nofollow标签,当然目前一些wordpress主题设置有这个nofollow标签功能。
如果手动每个链接加入是很麻烦,当然我们也可在wordpress写文章时,在技术层面是有传递出去权重。这样所有的外部链接就会自动加上nofollow标签。
//文章自动nofollowadd_filter( 'the_content', 'tin_seo_wl');function tin_seo_w闲闲互娱手游平台l( $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*"/'; 征途国际pg官网入口 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标签。
- 最近发表
- 随机阅读
-
- html5响应式时间轴页面模板大全
- 注册的域名怎么出售卖出去,域名交易渠道有哪些
- wordpress网站改版更换域名注意事项
- 大疆新款扫地机器人即将揭秘:别再忍耐,让尘埃落定!
- Crypto Markets Lost Over $400B as Bitcoin (BTC) Slumped by $10K in 2 Days (Weekend Watch)
- WordPress自适应淘宝客主题MiTao4.5
- Crypto Markets Add $70 Billion Daily as Bitcoin (BTC) Soars Past $71K (Market Watch)
- html+js简洁的音乐播放器,总有一款适合你
- 下雪花背景404错误页面代码
- 宝塔面板设置301重定向不保留URI参数问题
- WordPress博客网站.htaccess文件的作用
- PHP宝塔安装Swoole Loader扩展教程方法
- 小米米家推出折叠偏光近视太阳镜,轻巧便携又护眼,仅售199元!
- Crypto Markets in Retreat: BTC Losses $70K, WIF Plummets 11% Daily (Market Watch)
- HTML5+three实现3D酷炫拼魔方游戏代码
- WordPress时光轴图片主题Scopic2.0
- web前端盒子模型box model属性
- JavaScript简单返回顶部代码实例
- wordpress仿微博个人博客主题tongleer
- 小米米家扫拖机器人 M40 S 上市:升降导航、大吸力清洁新体验,2999元起,智能家居新选择!
- 搜索
-
- 友情链接
-