为了不影响自己的博客的权重,但是在文章中出现外部链接却没有自动添加,如果手动为外链添加外链跳转或访问这个网址就需要复制到浏览器中才能打开,这样的确有些不利于用户体验。
2 ]' x6 a! E# i 怎么办呢?那么,我们现在要做的就是在为 文章 的文章" target="_blank">文章中的外链添加”nofollow”属性.如果能够将博客为 文章 的文章" target="_blank">文章里的导出外链都加上nofollow标签,这样既能够阻止权重的流失,也能提升用户体验,何乐而不为!
* P- w. F$ S5 x3 _ 手动在编辑链接时添加”Nofollow”属性; 为 Emlog 的为 文章 的文章" target="_blank">文章" target="_blank">Emlog为 文章 的文章" target="_blank">文章编辑器默认的超链接中没有nofollow选项,因此只能选择html编辑再加上nofollow标签,不仅费时费力,而且还会有遗漏。4 z% C. J) @; H
很显然,这不是你想做的.但“如何给" target="_blank">Emlog博客文章外链自动添加nofollow属性”呢?因此如果能够通过修改Emlog源码实现自动给外链添加nofollow属性,那就轻松多了!- S6 O( @. Q2 ~. k9 ^; B+ P, k
大家可以通过修改模板来实现Emlog文章自动加nofollow属性的代码
t5 z9 _* K6 O, w; u 第一步.找到模版里module.php,在最后一行加入- <?php- k' x/ m9 l% l6 H. e& I% D7 M! G
- //内链nofollow+新窗口' {% e7 f9 P& \" |
- function SEO_replace($text) {
8 Q# N$ i9 [7 v5 r; h - return str_replace('<a href=', '<a rel="nofollow" target="_blank" href=', $text);
+ F7 O h9 S+ }) Y# H9 \ - }
) i$ i, s/ r/ K8 k( P9 V' e! L - ?>
复制代码 第二步.找到模板里echo_log.php,查找 :echo $log_content9 r8 j( w- `% H. W
修改成:echo seo_replace($log_content)$ f, z( {5 V2 H- @
|