您现在的位置是:WordPre问鼎pg下载安装ss无pc28官网在线插件外部链接自动添加nofollow标签 >>正文
WordPre问鼎pg下载安装ss无pc28官网在线插件外部链接自动添加nofollow标签
靡然成风网8人已围观
简介如果手动每个链接加入是很麻烦,这样所有的外部链接就会自动加上nofollow标签。在wordpress写文章时,当然我们也可以通过代码实现无插件添加方法。当然目前一些wor问鼎pg下载安装pc28官网...
如果手动每个链接加入是很麻烦,这样所有的外部链接就会自动加上nofollow标签。
在wordpress写文章时,当然我们也可以通过代码实现无插件添加方法。当然目前一些wor问鼎pg下载安装pc28官网在线dpress主题设置有这个nofollow标签功能。可以直接找一些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 文件中,有时内容会引用或分享一些外部链接地址,在技术层面是有传递出去权重。
Tags:
相关文章
Google搜索引擎搜索查询表现形式
WordPre问鼎pg下载安装ss无pc28官网在线插件外部链接自动添加nofollow标签https://www.google.com.hk/search?hl=zh-CN&ie=utf-8&q=seo&gws_rd=ssl看得出来seo自然意思就是seo,也就是说,q表示的是查询的关键词...
阅读更多
织梦dede:arclist标签使用说明
WordPre问鼎pg下载安装ss无pc28官网在线插件外部链接自动添加nofollow标签用过dedecms程序建站的都知道dede:arclist标签调用的比较多一般都是“特别推荐、推荐阅读(文章)、随机阅读、近期点击排行”等栏目。多数都是{dede:arclist orderby='r...
阅读更多
8款CSS3鼠标滑过图片动画特效代码
WordPre问鼎pg下载安装ss无pc28官网在线插件外部链接自动添加nofollow标签纯CSS3鼠标滑过图片文字动画特效,8款CSS3鼠标滑过图片动画效果,包括鼠标移动到图片时显示文字,图片与文字同时翻转显示,文字放大图片缩小,一半文字一半图片旋转显示等css+html自适应动画特效。...
阅读更多