WordPress无加拿大PC28网站入口巅峰国际下载页面在哪插件外部链接自动添加nofollow标签
这样所有的外部链接就会自动加上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 文件中,当然我们也可以通过代码实现无插件添加方法。在技术层面是巅峰国际下载页面在哪有传递出去权重。加拿大PC28网站入口有些外部链接是没有加Nofollow标签,严格要求的话是需要在外部链接全部加上nofollow标签。如果手动每个链接加入是很麻烦,
在巅峰国际下载页面在哪wordpress写文章时,加拿大PC28网站入口当然目前一些wordpress主题设置有这个nofollow标签功能。
可以直接找一些wordpress插件安装。- 最近发表
- 随机阅读
-
- JavaScript语法构成/关键字保留字及变量
- dedecms织梦5.7仿站视频教程(初级上部)
- DedeCMS Error Warning提示解决方法
- dedecms织梦仿站工具软件下载
- 帝国cms开源程序EmpireCMS
- WordPress自适应高清图片主题Perimg1.2
- 个人网站dedecms设置URL绝对路径/地址
- 个人网站阿里云IPC备案10天办理完成
- html5常用标签定义及使用说明
- wordpress用户头像无法(自定义)本地上传修改
- WordPress上传文件尺寸超过php.ini限制解决方法
- 织梦dedecms红黑配图片模板源码v2.0
- 仿新浪微博个人主页html网站模板
- CSS颜色color与度量单位em
- 个人网站dedecms设置URL绝对路径/地址
- web前端开发表单form/input标签
- 搜索引擎的工作原理(一)
- CSS3浏览器前缀和长度单位rem
- wordpress网站隐藏内容付费阅读/下载插件foxpay
- wordpress主题猫ztmao模板源码分享
- 搜索
-
- 友情链接
-