WordPre澳门庄闲网站游戏ss无九游app 官方插件外部链接自动添加nofollow标签
严格要求的话是需要在外部链接全部加上nofollow标签。当然目前一些wordpress主题设置有这个nofollow标签功能。在技术层面是有传递出去权重。当然我们也可以通过代码实现无插件添加方法。有时内容会 在wordpress写文章时, 添加到当前主题Funcions.php 文件中,//文章自动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;}
- 最近发表
- 随机阅读
-
- wordpress提示function.call
- WordPress博客网站.htaccess文件的作用
- 织梦dedecms修改文章,时间不变的方法
- 个人博客网站常用优化内容方法
- dedecms添加文章时禁止自动提取关键字
- 宝塔Linux面板地址/用户名密码忘记找回方法
- 酷炫html5 canvas全屏背景动画代码
- 去掉织梦cms底部的Powered by DedeCms
- dedecms织梦仿站工具软件下载
- CSS边框border样式属性设置
- jquery css3图片翻转3D动画切换特效代码
- WordPress无插件外部链接自动添加nofollow标签
- dedecms文章栏目列表页标题增加序号
- wordpress博客纯代码去掉分类目录Category
- CSS边框border样式属性设置
- 个人域名IPC备案/网站备案注意事项
- wordpress移除后台外观下的编辑和仪表盘的模块
- 免费简单图床EasyImages2.0源码
- 小米米家折叠偏光太阳镜:轻薄时尚,价格亲民,你值得拥有!
- JavaScript对象和数组(Object类型与Array类型)
- 搜索
-
- 友情链接
-