<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Domety &#187; 标题</title>
	<atom:link href="http://domety.com/archives/tag/%e6%a0%87%e9%a2%98/feed/" rel="self" type="application/rss+xml" />
	<link>http://domety.com</link>
	<description>分享软件、互联网应用技巧以及开发技能</description>
	<lastBuildDate>Wed, 26 May 2010 14:28:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>为页面标题添加页码</title>
		<link>http://domety.com/archives/233/</link>
		<comments>http://domety.com/archives/233/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 12:05:52 +0000</pubDate>
		<dc:creator>DDBug</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[标题]]></category>
		<category><![CDATA[页面]]></category>

		<guid isPermaLink="false">http://domety.com/?p=233</guid>
		<description><![CDATA[说起来这篇文章应该很早以前就写的，可能是感觉这只是一个很小很小的技巧吧，所以也没提上日程。
自从小站添加了分页导航以后，发现了一个问题：搜索引擎收录的页面中，有很多标题重复的网页，但链接地址却不一样。认真一看才知道是分页的原因，分页之后链接地址不一样了，形如http://domety.com/page/2/、http://domety.com/page/3/等，但标题还是首页的标题。这种情况对搜索引擎来说是非常不友好的。

于是我就想到，何不在标题中加上页码呢？这样就能避免标题重复的问题了，那就修改header.php文件吧，在&#60;title&#62;和&#60;/title&#62;之间加入以下代码
&#60;?php $paged = get_query_var('paged'); if($paged &#62; 1) printf('第%s页&#38;laquo;',$paged); ?&#62;
如果当前页面不是第一页的话，就在标题中显示页码。具体效果可以点击小站的分页导航看一下，搜索引擎收录结果如下

在这里也提醒一下使用分页插件的朋友，最好也给标题加个页码，或者使用其它你能想到的方法来区别各个标题，争取做到一个链接对应一个标题。
版权声明: 转载时请以超链接形式标明文章原始出处和作者信息本文来自: Domety&#187;《为页面标题添加页码》本文链接: http://domety.com/archives/233/本文作者: DDBug发表时期: 一月 27th,2010关键字: WordPress标题页面本站的feed地址已经更改为http://feed.domety.com/,请朋友们手动更改一下，谢谢相关文章给文章添加“收藏到”(QQ书签、Google书签、百度搜藏)WordPress中给文章加入版权声明WordPress性能测试——查看页面生成时间个性评论头像——图解gravatar全球通用头像向搜索引擎提交站点<ul style="color:#808080;padding:10px;border:1px solid #D7D7D7;list-style-type:none;"><li><a href="http://creativecommons.org/licenses/by/3.0/deed.zh">版权声明</a>: 转载时请以超链接形式标明文章原始出处和作者信息</li><li>本文来自: <a href="http://domety.com">Domety</a>&raquo;<a href="http://domety.com/archives/233/">《为页面标题添加页码》</a></li><li>本文链接: <a href="http://domety.com/archives/233/" title="为页面标题添加页码">http://domety.com/archives/233/</a></li><li>本文作者: <a href="http://domety.com">DDBug</a></li><li>发表时期: 一月 27th,2010</li><li>关键字: <a href="http://domety.com/archives/tag/wordpress/" rel="tag">WordPress</a><a href="http://domety.com/archives/tag/%e6%a0%87%e9%a2%98/" rel="tag">标题</a><a href="http://domety.com/archives/tag/%e9%a1%b5%e9%9d%a2/" rel="tag">页面</a></li></ul><p style="color=red">本站的feed地址已经更改为<a href="http://feed.domety.com/">http://feed.domety.com/</a>,请朋友们手动更改一下，谢谢</p><h2>相关文章</h2><ul><li><a href="http://domety.com/archives/210/">wordpress自定义页面</a></li><li><a href="http://domety.com/archives/195/">wordpress订阅RSS最新方法</a></li><li><a href="http://domety.com/archives/84/">成功升级WordPress到2.8.5</a></li><li><a href="http://domety.com/archives/188/">为wordpress添加阅读RSS功能</a></li><li><a href="http://domety.com/archives/199/">向搜索引擎提交站点</a></li></ul>]]></description>
			<content:encoded><![CDATA[<p>说起来这篇文章应该很早以前就写的，可能是感觉这只是一个很小很小的技巧吧，所以也没提上日程。</p>
<p>自从小站添加了分页导航以后，发现了一个问题：搜索引擎收录的页面中，有很多标题重复的网页，但链接地址却不一样。认真一看才知道是分页的原因，分页之后链接地址不一样了，形如<a href="http://domety.com/page/2/">http://domety.com/page/2/</a>、<a href="http://domety.com/page/2/">http://domety.com/page/3/</a>等，但标题还是首页的标题。这种情况对搜索引擎来说是非常不友好的。<span id="more-233"></span></p>
<p><img class="alignnone" title="标题重复" src="http://i623.domety.com/albums/tt312/baolai5/201001/domety_001.png" alt="" width="566" height="291" /></p>
<p>于是我就想到，何不在标题中加上页码呢？这样就能避免标题重复的问题了，那就修改header.php文件吧，在&lt;title&gt;和&lt;/title&gt;之间加入以下代码</p>
<pre>&lt;?php $paged = get_query_var('paged'); if($paged &gt; 1) printf('第%s页&amp;laquo;',$paged); ?&gt;</pre>
<p>如果当前页面不是第一页的话，就在标题中显示页码。具体效果可以点击小站的分页导航看一下，搜索引擎收录结果如下</p>
<p><img class="alignnone" title="标题带有页码" src="http://i623.domety.com/albums/tt312/baolai5/201001/domety_002.png" alt="" width="576" height="95" /></p>
<p>在这里也提醒一下使用分页插件的朋友，最好也给标题加个页码，或者使用其它你能想到的方法来区别各个标题，争取做到一个链接对应一个标题。</p>
<ul style="color:#808080;padding:10px;border:1px solid #D7D7D7;list-style-type:none;"><li><a href="http://creativecommons.org/licenses/by/3.0/deed.zh">版权声明</a>: 转载时请以超链接形式标明文章原始出处和作者信息</li><li>本文来自: <a href="http://domety.com">Domety</a>&raquo;<a href="http://domety.com/archives/233/">《为页面标题添加页码》</a></li><li>本文链接: <a href="http://domety.com/archives/233/" title="为页面标题添加页码">http://domety.com/archives/233/</a></li><li>本文作者: <a href="http://domety.com">DDBug</a></li><li>发表时期: 一月 27th,2010</li><li>关键字: <a href="http://domety.com/archives/tag/wordpress/" rel="tag">WordPress</a><a href="http://domety.com/archives/tag/%e6%a0%87%e9%a2%98/" rel="tag">标题</a><a href="http://domety.com/archives/tag/%e9%a1%b5%e9%9d%a2/" rel="tag">页面</a></li></ul><p style="color=red">本站的feed地址已经更改为<a href="http://feed.domety.com/">http://feed.domety.com/</a>,请朋友们手动更改一下，谢谢</p><h2>相关文章</h2><ul><li><a href="http://domety.com/archives/193/">wordpress2.9模板果然支持page-slug和page-id了</a></li><li><a href="http://domety.com/archives/244/">对所有日志的指定字符串进行替换</a></li><li><a href="http://domety.com/archives/132/">wordpress中显示页面位置：当前位置</a></li><li><a href="http://domety.com/archives/84/">成功升级WordPress到2.8.5</a></li><li><a href="http://domety.com/archives/210/">wordpress自定义页面</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://domety.com/archives/233/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
