WordPress无炸金花app下载免费最新华体育官网app下载入口版插件外部链接自动添加nofollow标签
有些外部链接是没有加Nofollow标签,这样所有的外部链接就会自动加上nofollow标签。如果手动每个链接加入是很麻烦,在技术层面是有华体育官网app下载入口传递出去权重。炸金花app下载免费最新版当然我们也可以通过代码实现无插件添加方法。可以直接找一些wordpress插件安装。
在wordpress写文章时,
//文章自动nofollowadd_filter( 'the_content', 'tin_seo_wl');function tin_seo_w华体育官网app下载入口l( $content ) { $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>"; if(preg炸金花app下载免费最新版_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主题设置有这个nofollow标签功能。
- 最近发表
- 随机阅读
-
- SEO如何分析网站
- Excel表格批量提取文字上的超链接
- 圣诞节幽灵404页面代码
- CSS3文本效果text
- 全站死链接检查工具Xenu下载
- HTML5 audio如何实现播放多个MP3音频
- JavaScript什么是正则表达式var
- 个人网站本地搭建Apache+PHP+MySQL环境
- sublime text3的快捷键/使用Emmet插件
- js实现手机访问网页自动跳转到手机移动页面
- wordpress XIU主题(阿里百秀)小清新cms模板V5.6
- wordrpess文章链接如何301重定向
- dedecms模板源码程序安装常见问题
- dedecms仿站之index.htm(主页模板)标签介绍
- SEO网站编辑文章如何伪原创
- wordpress搬家后上传图片出现错误
- 小米米家洗衣机Pro蓝氧新上市:洗净比高达1.27,仅需1367元起,省钱又实用!
- JavaScript对象中的方法/如sort(参数)方法
- SEO网站编辑文章如何伪原创
- 宝塔面板设置301重定向不保留URI参数问题
- 搜索
-
- 友情链接
-