WordPress SEO:Robots.txt的优化
Robots.txt文件对于Wordpress自建博客在搜索引擎中获取较好的排名和流量有很大的作用,因为它可以有效防止wordpress复制内容的不好影响。Google在其官方指南中就谈到Robots.txt对于google爬虫的作用:
Make use of the robots.txt file on your web server. This file tells crawlers which directories can or cannot be crawled. Make sure it’s current for your site so that you don’t accidentally block the Googlebot crawler.
那么该如何设置robots.txt文件呢?对于wordpress博客,我们可以从两个地方来设置好对于搜索引擎爬虫的限制访问。
一、header.php中的robots meta的优化
- <?php if(is_single() || is_page() || is_home()) { ?>
- <meta name="googlebot" content="index,follow" />
- <meta name="robots" content="all,index,follow" />
- <meta name="msnbot" content="all,index,follow" />
- <?php } else { ?>
- <meta name="googlebot" content="noindex,noarchive,follow" />
- <meta name="robots" content="noindex,follow" />
- <meta name="msnbot" content="noindex,follow" />
- <?php }?>
这样的代码告诉搜索引擎爬虫除了首页、文章页面以及独立页面外的其他页面只检索不收录。
二、robots.txt的设置
在网站的根目录下添加robots.txt并正确设置是很有用处的。以下的例子简单告诉robots.txt该怎么使用。
- Disallow: /about/
- Disallow: /contact/
- Disallow: /tag/
- Disallow: /wp-admin/
- Disallow: /wp-includes/
- Disallow: /contact
- Disallow: /wp-
- Disallow: /feed/
- Disallow: /trackback/
- User-agent: Googlebot
- Disallow: /*.php$
- Disallow: /*.js$
- Disallow: /*.inc$
- Disallow: /*?*
原文地址:http://www.lenoza.com/seo-wordpress/wordpress-robotstxt-optimized-for-seo/
[…] Meta Tags的使用对于网站的搜索引擎优化起到很大的作用,虽然有人说这些作用在日益缩水,但是目前而言仍然是不能忽视的。这里所谈到的Meta Tags包括 description、keywords部分,其他的诸如content-type、content-language、author等等都对网站的搜索引擎优化不构成主要作用。而meta robots部分在Robots.txt的优化已经谈到这里就不再重复内容了。description主要涉及网站的描述说明以及页面的主要内容介绍,keywords是网站或者页面关键词罗列。在搜索引擎对网站收录的时候,首页的描述往往会依据网站的description,而keywords可以让网站减少重复内容的出现。正确使用此类meta tags对于网站的搜索引擎收录和网站关键词排名有很大的作用。 […]
谢谢 我正在折腾wp呢 很有帮助