14

今天终于禁用了All in one seo插件 最开始用All in one seo是为了重写标题结构,因为Wordpress的标题结构是博客名在前面,这样一来访问者看着别扭,二来对搜索引擎不友好。

后来有发现All in one seo真的很消耗服务器的资源,正好这次换主题,就着手把All in one seo的功能通过修改主题来实现,参考了很多文章,今天终于搞定了。

老耿的博客通过All in one seo实现的功能:

  1. 通过All in one seo加入博客名、描述、关键字。
  2. 重写标题,将标题改为:文章名 | 老耿的博客,(All in one seo默认格式)。
  3. 通过All in one seo加入关键字,并将每篇文章的标签(Tags)也做为关键字。
  4. 原All in one seo重写标题设置:
    原All in one seo重写标题设置

修改后实现:

  1. 将博客名、描述、关键字直接添加到主题模板中。
  2. 通过修改主题将标题结构修改为All in one seo与一致,避免被搜索引擎惩罚。
  3. 通过自定义域,新建keywords字段来实现关键字。

修改方式主要参考柳城的这篇文章

针对STheme主题修改:

先下载这个desc.php,文件解压后打开按自己的要求修改博客名、描述以及分类和页面的描述等信息,并上传到主题所在目录。

将header.php中的以下代码:

<?php $the_title = wp_title(' - ', false); if ($the_title != '') : ?>
<title><?php echo wp_title('',false); ?> | <?php bloginfo('name'); ?></title>
<?php else : ?>
<title><?php bloginfo('name'); ?></title>
<?php endif; ?>
<?if (is_home()){
$description = " ";
} elseif (is_single()){
if ($post->post_excerpt) {
$description     = $post->post_excerpt;
} else {
$description = substr(strip_tags($post->post_content),0,220);
}
}
?>
<meta name="description" content="<?=$description?>" />

替换为:

<?php include_once("desc.php"); ?>

注意:如果以前使用All in one seo来添加关键字的话,一旦禁用All in one seo的话,所有的关键字就都没有了,如果会操作数据库可以将数据导到keywords中,文章不多的话也可以手动将内容复制到keywords中,我就是这么做的,正好把以前一些内容整理了一下。

为什么使用自定义域字段添加关键字

修改后的文章关键字并没有将标签,而是使用新建自定义域keywords字段都作为关键字,因为老耿觉得有些标签并不适合直接做为关键字,还有一些为了贴合每篇文章的关键字,可能会造成大量如Windows 7,Windows 7密码,Windows7加密这样的标签,而标签是给访问者看的,关键字是给搜索引擎看的,大量的标签堆砌在一起访问者很难从其中找到自己要找的东西,所以决定使用自定义域来加入关键字。

最近有时间也会把标签重新整理一下,希望能更明确一些,与分类配合,能更容易找到感兴趣的内容。

转载请注明出处: 转载自老耿的博客---http://www.laogeng.org

本文链接地址: http://www.laogeng.org/archives/1037.html

分享家:Addthis中国

相关日志

,

9 条评论 于 “今天终于禁用了All in one seo插件”

添加评论

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)