<?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>山仔's blog</title>
	<atom:link href="http://hillboy.org/feed" rel="self" type="application/rss+xml" />
	<link>http://hillboy.org</link>
	<description>Aspire to live in freedom</description>
	<lastBuildDate>Fri, 18 May 2012 02:24:59 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4</generator>
		<item>
		<title>代码实现自动添加keywords及description</title>
		<link>http://hillboy.org/articles/automatic-adding-keywords-and-description.html</link>
		<comments>http://hillboy.org/articles/automatic-adding-keywords-and-description.html#comments</comments>
		<pubDate>Sat, 05 May 2012 06:27:53 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[资讯杂谈]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3630</guid>
		<description><![CDATA[今天终于下定决心抛弃了All in one seo插件，全部改用代码实现了自动添加keywords及description，不知道谁说的，能用代码实现的决不用插件。正因如此，花了我一下午的时间终于搞掂了，包括博客标题也优化了。在网上看了很多文章教程，基本满足一个需求却不能满足另外的需求，集合各方所长和请教高人之后，得出自己的代码，下面分享给大家。]]></description>
			<content:encoded><![CDATA[<p>今天终于下定决心抛弃了All in one seo插件，全部改用代码实现了自动添加keywords及description，不知道谁说的，能用代码实现的决不用插件。正因如此，花了我一下午的时间终于搞掂了，包括博客标题也优化了。在网上看了很多文章教程，基本满足一个需求却不能满足另外的需求，集合各方所长和请教高人之后，得出自己的代码，下面分享给大家。<br />
<span id="more-3630"></span><br />
首先是博客标题的优化，将代码添加到主题模板header.php里面，替换原来的<code>&lt;title&gt;&lt;/title&gt;</code>标签。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;title&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #666666; font-style: italic;">// 如果是文章详细页面和独立页面, 显示文章标题</span>
	 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		wp_title<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'right'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// 如果是类目页面, 显示类目表述</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s 分类的文章存档 - '</span><span style="color: #339933;">,</span> single_cat_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// 如果是标签页面, 显示标签表述</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_tag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s 标签的文章存档 - '</span><span style="color: #339933;">,</span> single_tag_title<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// 如果是搜索页面, 显示搜索表述</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_search<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s 的搜索结果'</span><span style="color: #339933;">,</span> wp_specialchars<span style="color: #009900;">&#40;</span><span style="color: #000088;">$s</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// 如果是日期页面, 显示日期范围描述</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_day<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y年n月j日'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_year<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y年'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> get_the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y年n月'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%1$s 的文章存档 - '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>is_404<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;404错误页面 - &quot;</span><span style="color: #339933;">;</span>
 	<span style="color: #009900;">&#125;</span> 
	<span style="color: #666666; font-style: italic;">// 添加博客名.</span>
	bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// 在首页添加博客描述.</span>
	<span style="color: #000088;">$site_description</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'description'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'display'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$site_description</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; - <span style="color: #006699; font-weight: bold;">$site_description</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Add a page number if necessary:</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$page</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">' - '</span> <span style="color: #339933;">.</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Page %s'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'hillboy'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$paged</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/title&gt;</pre></td></tr></table></div>

<p>我设置的是“标题 - 网站名”这样的方式，所以你会看见标题后面都有“空格-空格”，这个请自行按需设置。</p>
<p>再来就是自动添加关键词及description，这个可是花了我很长时间才搞掂的，将代码添加到主题模板header.php里的<code>&lt;/head&gt;</code>标签前面。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;好明显,呢个只不过系一个普普通通的个人博客,得闲写下个人日记,同埋一D闲杂野,对一D野既睇法观后感咁咯.&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;山仔,博客,山仔博客,hillboy,blog,日记,杂谈,观后感,资讯&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// 分类和标签页面使用描述（后台分类目录中设置）作为description，使用名字作为keywords。</span>
<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_tag<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> is_category<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ? category_description<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> tag_description<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$description</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,-</span><span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> single_cat_title<span style="color: #009900;">&#40;</span>”<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// 文章和页面使用摘要作为description，没有的话就使用自定义字段的内容，否则使用内容前220个字符作为description。</span>
<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$description1</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;description&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$description2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mb_strimwidth</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">220</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$description</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$description1</span> ? <span style="color: #000088;">$description1</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$description2</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">// 填写自定义字段keywords时显示自定义字段的内容，否则使用文章tags作为keywords</span>
	<span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;keywords&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keywords</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$tags</span> <span style="color: #339933;">=</span> wp_get_post_tags<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tags</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$tag</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>        
        <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$keywords</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tag</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #339933;">;</span>    
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$keywords</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rtrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keywords</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">','</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
// 输出description和keywords
&lt;meta name=&quot;description&quot; content=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$description</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$keywords</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
// 判断是什么页面输出搜索引擎抓取信息
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;!</span>is_paged<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;meta name=&quot;robots&quot; content=&quot;index,follow&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;meta name=&quot;robots&quot; content=&quot;noindex,follow&quot; /&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>补充一下，自定义字段的意思就是你编辑文章或页面的时候里面的那个自定义栏目，将设置的字段值填好，这样就可以直接调用，等于自定义description和keywords了，如图：</p>
<div id="attachment_3631" class="wp-caption aligncenter" style="width: 510px"><a href="http://hillboy.org/upload/2012/05/zidingyi.jpg"><img src="http://hillboy.org/upload/2012/05/zidingyi.jpg" alt="自定义栏目" title="自定义栏目" width="500" height="398" class="size-full wp-image-3631" /></a><p class="wp-caption-text">自定义栏目</p></div>
<p>至此大功告成，不懂的话不要问我，因为我也是不懂的，只是这里抄点那里抄点集合而成，然后大概看得明白是什么意思，但具体这个语句表示什么我就不懂了。</p>
<p>2012.5.8　　修复摘要输入代码</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="代码实现自动添加keywords及description" href="http://hillboy.org/articles/automatic-adding-keywords-and-description.html">代码实现自动添加keywords及description</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/automatic-adding-keywords-and-description.html/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>广州沙面游</title>
		<link>http://hillboy.org/articles/gzshamian.html</link>
		<comments>http://hillboy.org/articles/gzshamian.html#comments</comments>
		<pubDate>Tue, 01 May 2012 16:37:40 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3620</guid>
		<description><![CDATA[今天和女朋友去了广州沙面游览一番，活了二十几年人这还是第一次去这个离自己不远的地方，其实说起来附近还有很多景点我都没去过呢，以后有时间都得去游览一下。本来今天女朋友公司有活动的，不过她嫌下午才搞导致时间不好安排，所以取消了去公司活动转为中午过来我家吃饭然后下午去广州沙面。]]></description>
			<content:encoded><![CDATA[<p>今天和女朋友去了广州沙面游览一番，活了二十几年人这还是第一次去这个离自己不远的地方，其实说起来附近还有很多景点我都没去过呢，以后有时间都得去游览一下。本来今天女朋友公司有活动的，不过她嫌下午才搞导致时间不好安排，所以取消了去公司活动转为中午过来我家吃饭然后下午去广州沙面。<br />
<span id="more-3620"></span><br />
今天是五一小假期的最后一天，还好人不是特别多，坐地铁的时候也没有像多人那样挤不上车。出门上地铁坐几个站到了黄沙站，D出口上天桥过去就到了，也就几百米的距离，所以说坐地铁过去还是挺方便的。沙面只所以有名是它的建筑风格，因为这里以前曾经是英法租界，所以有大量的欧洲风格建筑，还有很多国家的领事馆。不过这地方去过一次之后也不会有去第二次的念头，看过一次之后也就那种了，当然如果你是住附近的话那就另当别论，经常过去拍拖散步还是还好的。</p>
<div id="attachment_3621" class="wp-caption aligncenter" style="width: 510px"><img class="aligncenter size-full wp-image-3621" title="沙面北街入口" src="http://hillboy.org/upload/2012/05/shamian1.jpg" alt="沙面北街入口" width="500" height="373" /><p class="wp-caption-text">沙面北街入口</p></div>
<div id="attachment_3622" class="wp-caption aligncenter" style="width: 510px"><img class="aligncenter size-full wp-image-3622" title="沙面北街" src="http://hillboy.org/upload/2012/05/shamian2.jpg" alt="沙面北街" width="500" height="373" /><p class="wp-caption-text">沙面北街</p></div>
<div id="attachment_3623" class="wp-caption aligncenter" style="width: 510px"><img class="aligncenter size-full wp-image-3623" title="沙面星巴克" src="http://hillboy.org/upload/2012/05/shamian3.jpg" alt="沙面星巴克" width="500" height="373" /><p class="wp-caption-text">沙面星巴克，下次有时间来这里喝咖啡。</p></div>
<div id="attachment_3624" class="wp-caption aligncenter" style="width: 510px"><img class="aligncenter size-full wp-image-3624" title="不知名雕像" src="http://hillboy.org/upload/2012/05/shamian4.jpg" alt="不知名雕像" width="500" height="373" /><p class="wp-caption-text">不知名雕像</p></div>
<div id="attachment_3625" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-3625" title="外事办公室" src="http://hillboy.org/upload/2012/05/shamian5.jpg" alt="外事办公室" width="500" height="373" /><p class="wp-caption-text">外事办公室，估计这里没实质工作吧。</p></div>
<div id="attachment_3626" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-3626" title="台湾银行" src="http://hillboy.org/upload/2012/05/shamian6.jpg" alt="台湾银行" width="500" height="373" /><p class="wp-caption-text">台湾银行</p></div>
<p>游览完后去了上下九那边的恒宝广场逛，在沙面的时候已经很累了，还要逛商场累死我了。今天天气又热，在沙面一直走就一直流汗，回家后马上洗澡。总体来说今天还是不错的，以后也要再多点这样的外出。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="广州沙面游" href="http://hillboy.org/articles/gzshamian.html">广州沙面游</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/gzshamian.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>电脑折腾</title>
		<link>http://hillboy.org/articles/computer-toss.html</link>
		<comments>http://hillboy.org/articles/computer-toss.html#comments</comments>
		<pubDate>Sun, 29 Apr 2012 19:12:20 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3619</guid>
		<description><![CDATA[昨天早上起床照例开电脑，没过多久CPU风扇就嘈得很厉害，一到夏天天气热就这样子，实在没办法只好折腾清理一下。清理出来黑色的尘一大堆，脏得可怕，但这时候悲剧发生了，把风扇装回上去之后开不了机，没有任何报警声音，上网查了下说可能是CPU、主板、电源其中之一出问题。电源是有的，CPU也应该没问题，就怕主板出问题了，因为我还有用拧干的布来擦过电源风扇和机箱，心想会不会是滴水到主板上，而且我是没拔电源的。]]></description>
			<content:encoded><![CDATA[<p>昨天早上起床照例开电脑，没过多久CPU风扇就嘈得很厉害，一到夏天天气热就这样子，实在没办法只好折腾清理一下。清理出来黑色的尘一大堆，脏得可怕，但这时候悲剧发生了，把风扇装回上去之后开不了机，没有任何报警声音，上网查了下说可能是CPU、主板、电源其中之一出问题。电源是有的，CPU也应该没问题，就怕主板出问题了，因为我还有用拧干的布来擦过电源风扇和机箱，心想会不会是滴水到主板上，而且我是没拔电源的。<br />
<span id="more-3619"></span><br />
折腾了一早上都没有搞掂，线都重插过了，没办法只好拿去电脑城修了。饭后驱车到鸿运电脑城，找不到停车位就停在河堤边上的行人道，还担心会不会抄牌。随便找了家修电脑，那年轻人插上那个检测的版看了下之后跟我说20元包搞掂，问我搞不搞。我想我又是个冤大头，只好说搞了，然后追问他是什么原因，答曰太多尘了，我顿时呆住了，原来我忽略了除风扇之外其他地方的灰尘。搞就搞吧，亏也亏不了多少，还有人帮你把主板卸下来清理一遍，CPU重新加上散热的那个不知道什么东西，也不算黑了。</p>
<p>清理的过程还是比较快的，然后心想自己难得来到电脑城一趟，不如升级一下电脑吧，我也不要求别的，只要玩英雄联盟特效能全开就够了，结果连清洁一共140元买了个二手显卡。显示当时插上去试过效果貌似还行，但限于他那里屏幕小我又赶时间没来得及详细测试，回家之后却发现没装驱程的话根本起不了游戏开特效的作用。那简单啦，下个驱程装上就是了，这时候再次发生悲剧，驱程死活装不上，无论怎么卸载、用什么版本都不行，因为赶着和女朋友还有她姐弟去唱K，就只好晚上再搞了。</p>
<p>唱了两个小时左右就去了和她父母吃饭，今天比较特别的是她姐带她男朋友去见家长，这样的好戏咱们当然不能错过啦。不过也没什么特别的，她父母不像其他人那样问长问短的，普普通通吃完饭搞掂，送完她回去之后我就继续投入到驱程安装中去了。经过无数次的卸载安装驱程，还有BIOS设置了那么一下，终于安装上，进游戏开特效没问题了。其实到现在我还没搞明白到底关不关BIOS设置事，反正后面几次装的时候没出错误说装上了。电脑硬件不懂还真是个硬伤啊，看来以后有时间得折腾学习拆一下主板什么的，起码了解一下培养到动手能力。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="电脑折腾" href="http://hillboy.org/articles/computer-toss.html">电脑折腾</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/computer-toss.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>2012年第17周小记</title>
		<link>http://hillboy.org/articles/small-note-of-17-weeks-in-2012.html</link>
		<comments>http://hillboy.org/articles/small-note-of-17-weeks-in-2012.html#comments</comments>
		<pubDate>Sat, 28 Apr 2012 13:30:44 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3618</guid>
		<description><![CDATA[周末晚上，明天就是五一假期了，我们这里可是放五天喔，然后4号星期五上一天又继续放两天，实在爽。自从几年前国家取消五一长假之后，我们这里可是继续执行放五天的策略。不过没有安排什么出游计划，就算有也因为只有我放五天，其他朋友都是正常放假，所有就算有计划也没人和我一起执行。]]></description>
			<content:encoded><![CDATA[<p>周末晚上，明天就是五一假期了，我们这里可是放五天喔，然后4号星期五上一天又继续放两天，实在爽。自从几年前国家取消五一长假之后，我们这里可是继续执行放五天的策略。不过没有安排什么出游计划，就算有也因为只有我放五天，其他朋友都是正常放假，所有就算有计划也没人和我一起执行。<br />
<span id="more-3618"></span><br />
要说起这个星期，我可惨了。首先星期一晚上女朋友因为工作上的事情不开心而我又没怎么理她导致她不开心，我也不是故意不理她的，因为很晚的时候才跟我说话，而我又比较累想睡觉，故而没怎么理睡觉去了。当然，我星期二晚上就过去她那里哄她去了，事情本来就不关我事，所谓的不关事我指的是不是因为我的原因导致你的不开心，而是你自身的原因，就因为我没有安抚你心情就发我脾气。那好吧，我好好的哄下你安抚你心情应该会好的。谁知道越哄越气，不过气的不是她而是我。我低声下气的哄她，但她还是冷言冷语的，说的话又拽，真是给你三分颜色上大红。一定非要哄到你满意为止么？你总得留点余地给别人吧。反正就是越哄越不开心导致大家心情都不好，最后我实在受不了一走了之。</p>
<p>情况一直持续到星期四晚上，总算等到她心情好了点，和她聊了一阵电话哄了下，也是同样的情况，已经低声下气地哄了，还得非要别人撕下脸皮不要尊严的哄才开心么？当时也是比较晚了，我也没表现出来我的不满，反而是她主动说要洗澡挂电话。有气我自己受着，我也没发她脾气，当时心不舒服头又疼，就打算发信息跟她说睡觉。谁知道我还没下Q她就Q我了，我耐着性子和她聊了两句就跟她说睡觉去了。</p>
<p>昨天星期五早上看微博，看见她11点半左右发的微博说什么男人出轨女人出轨的，我就发觉情况有异了。等她起床就发信息问她怎么回事，说了一大轮之后告诉我原来是看了我上个星期的日志，就是星巴克用微信那篇。唉，一波未平一波又起，之前闹情绪还没搞好现在又来这一出，我悔恨我实在不应该写上来博客的，本来就是记录一下贪好玩过瘾而做的事情，还真被我最后一句让她看见就惨了说中。晚上过去使尽浑身解数，最后终于安抚了她，留下的后遗症就是她对我的信任度大减，这个只能以后慢慢培养回来了。在此奉劝各位不要像我那么笨了。</p>
<p>今晚下班之后和几个同事一起去附近的壹品广场吃饭，吃的什么鸡蟹煲忘记的了，吃着感觉一般般，主要就是几个同事在一起吹水聊天。聊下大家工作上发生的趣事，毕竟大家不同办公室，收到的消息都各有不同的，还有对于现状讨论了下，反正就是聊天为主，吃饭为辅。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="2012年第17周小记" href="http://hillboy.org/articles/small-note-of-17-weeks-in-2012.html">2012年第17周小记</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/small-note-of-17-weeks-in-2012.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>2012年第16周小记</title>
		<link>http://hillboy.org/articles/small-note-of-16-weeks-in-2012.html</link>
		<comments>http://hillboy.org/articles/small-note-of-16-weeks-in-2012.html#comments</comments>
		<pubDate>Sat, 21 Apr 2012 18:33:30 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3608</guid>
		<description><![CDATA[为多写点日记，以后搞个一周小结，写下一周里面自己都干了些什么，2012年4.15-4.21是第十六周，这个对着右下角的日期数了我几遍才数准，数出来之后还上网查一下看下对不对，搜索出来的都是股市小结，不过还好数对了。其实这周还挺难写的，前几天才写了篇日记把基本情况都说了，现在也不能再多说一次，那就说下今天吧。]]></description>
			<content:encoded><![CDATA[<p>为多写点日记，以后搞个一周小结，写下一周里面自己都干了些什么，2012年4.15-4.21是第十六周，这个对着右下角的日期数了我几遍才数准，数出来之后还上网查一下看下对不对，搜索出来的都是股市小结，不过还好数对了。其实这周还挺难写的，前几天才写了篇日记把基本情况都说了，现在也不能再多说一次，那就说下今天吧。<br />
<span id="more-3608"></span><br />
今晚载完女朋友回家之后，独自一个人去了我家楼下新开的星巴克，以前有大半年没有去过星巴克了，想着自家楼下新开的，怎么也得去观摩一下吧。环境挺不错，比之前去的那间宽敞多了，风格也不一样，进去后发现员工都是认识的，原来都是之前那间调过来的。拿出上司给我的那张免费卷，点了一杯我最爱的摩卡，本想着坐外面可以吹风，不过外面位置太少了，就随便找了个位置坐下玩手机去了。心想着刚才忘记了问wi-fi密码，手机搜索了一下，发现名字不是单纯的星巴克英文，前面还多加了移动的CMCC。原来和移动合作了，登陆还得验证手机号码收密码才行，不像以前直接连接wi-fi输入密码就行，这样麻烦了很多。而且移动的wi-fi连国外的有点问题，我imessage有时候发不出，能发也挺慢，这个不好。</p>
<p>周围寻找了下看有没有美女，发觉10点钟方向有几个美女喔，其中一个还挺漂亮有韩国人feel的，不错。无聊手机打开微信，查看附近的人，100米内女的，有个头像挺漂亮的，显示四川成都，认真看了下发觉好像就是10点钟方向的那个美眉，看一下真人再看一下头像，还真的是呢，这个微信真的是个好东西，难怪去酒吧的人都开着微信。打招呼发了个hi过去没反应，我就继续手机看新闻了，然后又进来几个女的，看着其中一个有点眼熟，原来是一个老朋友，她没看见我，我就打电话说笑问她怎么穿得那么漂亮，然后她反应过来知道我在，然后看见我了。和她聊了几句之后我摩卡也差不多喝完了，把剩下的喝完就出门回家了。</p>
<p>回家后微信收到信息，原来是那个成都美眉验证加我了，和她聊了几句，得知去过来佛山这边玩的明天就要走了，还真没缘分呢。无聊打开了几个网页，然后继续投入到主题修改当中，今晚终于添加了另外一个一直想要的功能<a rel="external nofollow" href="http://www.neoease.com/inove-mouseover-to-show-comment-no/" title="iNove 中鼠标悬浮显示 @ 评论" target="_blank">《iNove 中鼠标悬浮显示 @ 评论》</a>。这个很酷的功能当年一直搞不掂，今晚再努力尝试一下，没想到原来是那么简单的，只要给ol添加一个id就好了，我实在太笨又太聪明了，具体演示可以在我博客中找个 @评论 看一下。不过暂时只能显示当页的评论，跨页的就不行了，不过也没所谓，我评论又不是多，除了留言那里之外其他不会有分页评论的。</p>
<p>好了，写了那么多应该够交功课了，还有这个文章不能给女朋友看到，不然看见我微信找美眉发我脾气就惨了。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="2012年第16周小记" href="http://hillboy.org/articles/small-note-of-16-weeks-in-2012.html">2012年第16周小记</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/small-note-of-16-weeks-in-2012.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>2012-04-19日记</title>
		<link>http://hillboy.org/articles/2012-04-19-diary.html</link>
		<comments>http://hillboy.org/articles/2012-04-19-diary.html#comments</comments>
		<pubDate>Thu, 19 Apr 2012 12:03:46 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3606</guid>
		<description><![CDATA[为了逼着自己更新博客写日志，想不到要写什么也得写，更新博客贵在坚持。当坚持成为一种习惯之后，就会达到质变，所以我一定要坚持更新博客。最近这个星期都很忙，白天工作忙得要死，晚上又要看书复习，当然偶尔抽点时间搞下博客也是有的，但却没有时间陪女朋友了。今天她休息，中午和晚上都没饭吃，对于午饭无话可说，但对于晚饭，我有时间却不愿意外出不能给她送吃的感到挺悔疚的。但白天工作实在太累了，回家之后就想躺在床上休息动都不想动，对于这种情况只能说抱歉了。]]></description>
			<content:encoded><![CDATA[<p>为了逼着自己更新博客写日志，想不到要写什么也得写，更新博客贵在坚持。当坚持成为一种习惯之后，就会达到质变，所以我一定要坚持更新博客。最近这个星期都很忙，白天工作忙得要死，晚上又要看书复习，当然偶尔抽点时间搞下博客也是有的，但却没有时间陪女朋友了。今天她休息，中午和晚上都没饭吃，对于午饭无话可说，但对于晚饭，我有时间却不愿意外出不能给她送吃的感到挺悔疚的。但白天工作实在太累了，回家之后就想躺在床上休息动都不想动，对于这种情况只能说抱歉了。<br />
<span id="more-3606"></span><br />
前两天早上起床在厕所大号的时候，手机看了下微博，看见一高中同学凌晨4点多发的微博，说什么保佑女儿之类的。心想是不是她女儿出事了，马上发了条短信给她老公（她老公也是高中同学），问了下是不是有事，叫他加油。大概到了10点多的时候他回了我信息，说有心了。之后我就没再问了，而是到了中午的时候问了其他高中同学，得知她女儿进了ICU病房，甚至医院还出了病危通知书，所以这两天都有在问她女儿的消息。今天早上看见她凌晨发的微博说女儿晚上发开口梦叫爸爸，心想情况应该好转了吧。可能她俩都没心情的原因吧，我们这些同学短信他们也没回，所以也无法得知进一步的消息了，希望她女儿快点好起来。</p>
<p>今天同事还钱给我了，忘记了应该是上个月的事情，他在QQ上问我借钱，说信用卡还款到期了，但又没钱在，急于还款所以就问我借钱了。当时我数了下钱包里头的钱，看见还有剩余的就借给了他，当时还说慢慢还不急的。然后一直到今天，因为已经发了工资嘛，自己本来就想着这几天提醒一下叫他还钱的，但他今天早上主动给我电话说发了工资有钱还了。对于还钱我肯定是欢天喜地的，毕竟很害怕别人抵赖或者迟迟不还，电话后马上过去他办公室收钱。其实最主要的是因为我这个月的卡数也比较多，如果他不还的话我到下个月工资日也挺拮据的。</p>
<p>昨天博客一位老朋友<a rel="nofollow" href="http://hillboy.org/articles/the-dead-of-night.html#comment-5681" target="_blank">@g </a>过来问我要电影，我顿时觉得很欣慰。这位朋友是我以前还在更新电视剧、电影的时候就过来支持我的一位朋友，想不到隔了那么久的时间他还记得我博客。其实一个纯生活的博客真的挺难生存的，可能除了自己之外就不会有人来看，也不像一些名人或者技术类的博客可以拥有大量的人气。博客的兴起应该是在4、5年前吧，那时候博客还是web2.0的一个标志，到了现在博客只能沦为社交网络组成的一部分了，而且像我这种独立博客就更加没社交可言。要社交的话只能自己努力去别人的博客评论得到回访的机会，这个并不是一个良好的发展。</p>
<p>不过无论有访问也好，没访问也好，只要自己心态好了就无所谓了，就像每位家长都想自己的儿女出人头地一样，但事实上却并不是每个人都能出人头地的，就想博客一样，能够出名的都是凤毛麟角的存在，所以，只要自己无所谓了，那就不会有太多的想法在里面。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="2012-04-19日记" href="http://hillboy.org/articles/2012-04-19-diary.html">2012-04-19日记</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/2012-04-19-diary.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>夜深人静的时候</title>
		<link>http://hillboy.org/articles/the-dead-of-night.html</link>
		<comments>http://hillboy.org/articles/the-dead-of-night.html#comments</comments>
		<pubDate>Fri, 13 Apr 2012 18:52:45 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3603</guid>
		<description><![CDATA[很久没有写过日记了，现在是凌晨两点零五分，外面黑蒙蒙静悄悄的，唯一的声音就是打字键盘上的机械音和因为主机温度过高而猛转的CPU风扇发出来的噪音。这风扇噪音挺烦人的，现在天气那么热，开机一阵就猛转了，时候要清理一下里面的灰尘了，就明天吧，还是改天有空好了。]]></description>
			<content:encoded><![CDATA[<p>很久没有写过日记了，现在是凌晨两点零五分，外面黑蒙蒙静悄悄的，唯一的声音就是打字键盘上的机械音和因为主机温度过高而猛转的CPU风扇发出来的噪音。这风扇噪音挺烦人的，现在天气那么热，开机一阵就猛转了，时候要清理一下里面的灰尘了，就明天吧，还是改天有空好了。<br />
<span id="more-3603"></span><br />
之前有来我博客的朋友应该看到我换了主题吧，为了修改主题足足花费了我一个星期的时间，包括白天和夜晚。开始我是用官方的Twenty Eleven主题来修改的，因为官方的主题功能比较多，而最为看中的就是现在博客右上方的那个搜索框，觉得点击之后会变长这个功能很酷，所以为了这个功能不停地修修改改。</p>
<p>因为我不懂代码这些东西，只会简单的CSS和复制粘贴，所以用了我四天的时间才改好，结果改好之后才发觉官方的主题太臃肿了，里面很多东西都用不到还影响了速度。本想着将就用着就算了吧，但处女座的洁癖性格不允许我就这样算，无奈之下只好试着在原来主题的基础上增加官方主题里面想要的功能吧。</p>
<p>原来没试过还真的不知道这么容易改，今天一天的时候就把想要的东西都添加修改好了，主要就是导航栏和搜索框，还有一些其它的小细节，这可能得益于前四天花的时间得来的经验吧。其实改的话真不难，麻烦的就是一些细节上的东西，这个对我来说就是一个挑战，现在攻克了这个主题还挺有成就和满足感的。</p>
<p>在改主题的时间里，学习了很多技术，主要的就是CSS上的一些应用，例如阴影、背景图片、<a rel="external nofollow" href="http://www.w3schools.com/css/css_image_sprites.asp" title="css sprites" target="_blank">css sprites</a>等。对于已经运用自如的朋友来说就是小菜一碟，但对于我这种一知半解的人来说就已经是很高深的技术了，还好现在已经有一定的了解，以后再用起来就不会多走弯路了。</p>
<p>曾几何时我的梦想是做一个网页设计师，设计很多漂亮的网站，梦想总是美好的。现在已经没了学习那种环境能让你学得更多，也更因为自己太懒惰的缘故没有去学习，造成了要浪费一个星期的时间去做别人几个小时就能做好的事情。</p>
<p>谈恋爱快一年了，下个月就是一周年了。现在和女朋友的感情还算稳定，上两个月矛盾比较多，不过现在都过去了，继续稳稳定定吧。有打算明年结婚，不过很多事情大家都还没有商量好，其实这些事情早就应该要商量了，但因为自己的逃避而一直拖了很久，现在是时候去正视了。</p>
<p>今晚写起来还挺有感觉的，可能太久没写的缘故，又可能是因为没写的日子里错过了很多应该记录的事情，所以现在写起来就特别特别的想把东西都写出来吧。很多朋友说我很久没更新，其实我每天都有上博客，就像看自己的儿子一样，但却没有力量去支撑着我让我去写一篇日记。检查友链的时候发现有很多失效了，也有几个撤了我的链接，不过对于现在来说，神马友链的都是浮云了，做不做都一样的。</p>
<p>Anyway，生活还是要继续的，博客也不能荒废掉，晚安。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="夜深人静的时候" href="http://hillboy.org/articles/the-dead-of-night.html">夜深人静的时候</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/the-dead-of-night.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>YSlow优化之Add Expires headers</title>
		<link>http://hillboy.org/articles/add-expires-headers.html</link>
		<comments>http://hillboy.org/articles/add-expires-headers.html#comments</comments>
		<pubDate>Thu, 05 Apr 2012 14:48:57 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[资讯杂谈]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3589</guid>
		<description><![CDATA[Add Expires headers，就是向文档添加一个有效期，告诉浏览器这个文档的有效性和持久性。如果已有缓存，文档就可以从浏览器中的缓存(除已经过期)而不是从服务器读取。接着，客户端验证缓存中的副本，看看是否过期或者失效，以决定是否必须从服务器获得更新。简单来说就是优化了这项可以加快网站速度，对于不经常更新的文件，例如CSS、图片文件都很有用，下次访问就直接从浏览器读取而不用向服务器下载。]]></description>
			<content:encoded><![CDATA[<p><a rel="external" href="http://developer.yahoo.com/performance/rules.html#expires" title="Add Expires headers" target="_blank">Add Expires headers</a>，就是向文档添加一个有效期，告诉浏览器这个文档的有效性和持久性。如果已有缓存，文档就可以从浏览器中的缓存(除已经过期)而不是从服务器读取。接着，客户端验证缓存中的副本，看看是否过期或者失效，以决定是否必须从服务器获得更新。简单来说就是优化了这项可以加快网站速度，对于不经常更新的文件，例如CSS、图片文件都很有用，下次访问就直接从浏览器读取而不用向服务器下载。<br />
<span id="more-3589"></span><br />
添加方法很简单，编辑.htaccess文件添加以下代码就可以了，注意第二行的ExpiresDefault "access plus 30 days"，表示所有文档默认有效期为30天，但可以被具体文档设定的有效期改变，例如我第三行的CSS文件就设定有效期为一年。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="html" style="font-family:monospace;">&lt;ifmodule expires_module&gt;
ExpiresActive On
ExpiresDefault &quot;access plus 30 days&quot;
ExpiresByType text/css   &quot;access plus 1 years&quot;
ExpiresByType text/html  &quot;access plus 1 years&quot;
ExpiresByType image/gif  &quot;access plus 1 years&quot;
ExpiresByType image/jpeg &quot;access plus 1 years&quot;
ExpiresByType image/jpg  &quot;access plus 1 years&quot;
ExpiresByType image/png  &quot;access plus 1 years&quot;
ExpiresByType image/x-icon &quot;access plus 1 years&quot;
ExpiresByType application/x-javascript &quot;access plus 30 days&quot;
&lt;/ifmodule&gt;</pre></td></tr></table></div>

<p>这个缓存只对本地服务器上的文档有效，像我这样外链有gravatar、google等的文件都是无效的，外链服务器设定他们的有效期只有5分钟，YSlow优化建议添加更长的时间，所以评分还是F。本博客首页跑分只有87分，还差3分才能达A。其它具体设置请按需自行设置，更多用法请参考：<a rel="external" href="http://httpd.apache.org/docs/2.0/mod/mod_expires.html" title="Apache Module mod_expires" target="_blank">Apache Module mod_expires</a>和<a rel="external" href="http://www.w3school.com.cn/media/media_mimeref.asp" title="MIME 参考手册" target="_blank">MIME 参考手册</a></p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="YSlow优化之Add Expires headers" href="http://hillboy.org/articles/add-expires-headers.html">YSlow优化之Add Expires headers</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/add-expires-headers.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>自定义WordPress侧边栏小工具显示页面</title>
		<link>http://hillboy.org/articles/widget-logic.html</link>
		<comments>http://hillboy.org/articles/widget-logic.html#comments</comments>
		<pubDate>Mon, 02 Apr 2012 09:00:41 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[资讯杂谈]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3578</guid>
		<description><![CDATA[很多时候我们需要将某些侧边栏在指定的页面中显示，例如让友情链接只在首页显示或者只在文章页显示，可以通过修改代码来达到效果。但对于我这种懒人或者菜鸟来说，当然希望能够有个插件直接帮我完成工作不用麻烦修改代码。Widget Logic就是这样一个插件，可以自定义WordPress小工具在那些显示中页面。]]></description>
			<content:encoded><![CDATA[<p>很多时候我们需要将某些侧边栏在指定的页面中显示，例如让友情链接只在首页显示或者只在文章页显示，可以通过修改代码来达到效果。但对于我这种懒人或者菜鸟来说，当然希望能够有插件直接帮我完成工作不用麻烦修改代码。Widget Logic就是这样一个插件，可以自定义WordPress小工具在那些显示中页面。<br />
<span id="more-3578"></span><br />
安装很简单，直接登陆你的wp博客后台，在安装插件那里搜索“Widget Logic”安装即可。安装后打开后台小工具页面，再展开自定义的模块会看到下面都多了一个Widget logic的栏目，如图：</p>
<p><img src="http://hillboy.org/upload/2012/04/Widget-Logic.png" alt="Widget-Logic" title="Widget-Logic" width="434" height="462" class="aligncenter" /></p>
<p>使用方法也很简单，只要在后面空白处填写上相对应的代码即可。例如上图中我打开的赞助模块，在后面空白处填写上“is_home()”并保存就可以了，“is_home()”表示这个模块只在首页中显示，如果我填上的是“is_single()”，就表示这个模块只在文章页中显示。</p>
<p>下面再附注些从网上收集来的关于Widget Logic 插件使用的一些常用设置代码：</p>
<p><code>is_home() 主页<br />
is_single() 文章页<br />
is_page() 页面<br />
is_category() 文章分类页<br />
is_tag() 文章标签页<br />
is_archive() 归档页<br />
is_404() 404页<br />
is_search() 搜索结果页<br />
is_feed() 订阅页</code></p>
<p>Widget Logic插件代码还可以使用语法，||表示或，&#038;&#038;表示和，!表示非，使用语法可以更加灵活的定义显示页面，语法示例如下：</p>
<p><code>!is_home() 除主页以外的页面显示<br />
!is_category(4) 仅在ID非4的分类显示<br />
is_home() || is_category('movies') 在主页或名称为movies的分类显示<br />
is_page('about') 仅在名称为about的页面显示<br />
is_home()&#038;&#038;!is_paged() 在首页显示，分页不显示</code></p>
<p>更多的用法请参考：<a rel="external nofollow" href="http://wordpress.org/extend/plugins/widget-logic/other_notes/" title="http://wordpress.org/extend/plugins/widget-logic/other_notes/" target="_blank">Widget Logic</a></p>
<p>不使用插件也能实现侧边栏自定义显示页面的方法，编辑sidebar.php文件：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_home <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;!</span>is_paged<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!-- categories --&gt;
&lt;li class=&quot;widget widget_categories&quot;&gt;
&lt;h3&gt;Categories&lt;/h3&gt;
&lt;ul&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_cats<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sort_column=name&amp;optioncount=1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/ul&gt;
&lt;/li&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>其实就是在你想要定义的小工具前后添加一段判断页面的代码就OK了。</p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="自定义WordPress侧边栏小工具显示页面" href="http://hillboy.org/articles/widget-logic.html">自定义WordPress侧边栏小工具显示页面</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/widget-logic.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>博客更换GegeHost香港机房</title>
		<link>http://hillboy.org/articles/blog-replacement-space.html</link>
		<comments>http://hillboy.org/articles/blog-replacement-space.html#comments</comments>
		<pubDate>Fri, 30 Mar 2012 13:18:47 +0000</pubDate>
		<dc:creator>臻</dc:creator>
				<category><![CDATA[生活随想]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://hillboy.org/?p=3586</guid>
		<description><![CDATA[这几天我在修改着博客，目的就是想YSlow跑分能够达A，奈何跑不过的那几样技术都不懂，所以也就算了。最大的收获就是让我学会了css sprites，这真是一个好东西，让博客中的图片都加到CSS中去，减少了网站请求数。其实以前就知道有这个技术，但一直觉得要用到PS的东西都很难，直到现在才发觉网络已经有N多工具可以使用，用起来是多么的简单。]]></description>
			<content:encoded><![CDATA[<p>这几天我在修改着博客，目的就是想<a title="YSlow" href="http://developer.yahoo.com/yslow/" target="_blank">YSlow</a>跑分能够达A，奈何跑不过的那几样技术都不懂，所以也就算了。最大的收获就是让我学会了<a href="http://www.w3schools.com/css/css_image_sprites.asp" title="css sprites" target="_blank">css sprites</a>，这真是一个好东西，让博客中的图片都加到CSS中去，减少了网站请求数。其实以前就知道有这个技术，但一直觉得要用到PS的东西都很难，直到现在才发觉网络已经有N多工具可以使用，用起来是多么的简单。<br />
<span id="more-3586"></span><br />
前几天大概26号左右吧，Godaddy后台的域名管理被河蟹了，故将拥有的两个域名都转到了<a href="https://www.dnspod.cn/" title="DNSpod" target="_blank">DNSpod</a>上去。之所以决定转出主要原因并不是问题Godaddy河蟹问题，而是在网上看到说域名解析还是交给专业的域名解析商比较好，对此我也是比较认同的。用过之后还真的挺好用，添加域名解析方便，解析生效速度快，从来没试过这么快的。不过有两个小问题，解析界面看下去一堆解析，多的话会看得比较乱吧。然后解析生效之后呢，我不知道是网络原因还是我个人原因什么的，生效没多久之后会失效一阵，最后又会好起来~不过这些都是小问题而已，域名解析了之后就不怎么去动它了。</p>
<p>最爽的事情某过于今天了，将主机由GegeHost美国机房换到GegeHost香港机房上去了，那个速度实在是爽啊~之前就在考虑空间问题了，因为在用的快要到期了，然后就一直在看香港和日本的空间，但又舍不得离开现在的GegeHost，用着熟悉也放心，换其他的可能又要重新去适应。对我这种念旧的人，还是继续续费吧，反正博客也没多少人看。联系了胡戈戈，跟他说续费，之后打开<a rel="nofollow" href="http://gege.taobao.com/" title="戈戈主机淘宝店" target="_blank">戈戈主机淘宝店</a>上去付款，几分钟后就显示已经续费了，很方便的说。</p>
<p>本来打算一直就这样，靠自己优化下博客速度就算了，没想到奇迹在今天出现了，今天自己域名出了点问题问了下胡戈戈，后来发现是傲游的问题。之后和胡戈戈聊了两句，问他有没有计划上香港和日本的空间，他告诉我早就有了。我郁闷啊，咋你不早点告诉我呢，然后叫他给了个香港的演示我看，ping了下延时平均在20MS左右，一个字：爽！立马就叫他帮我换空间，反正也不是第一次换了，只不过之前换来换去都是美国的。胡戈戈的效率就是高，前后5分钟不到就叫我解析域名到新的IP上去，马上将域名解析到新的IP上，十几分钟后开始享受香港空间带来的速度。</p>
<p><img src="http://hillboy.org/upload/2012/03/GegeHost.png" alt="GegeHost" width="500" height="350" class="aligncenter" /></p>
<p>至今用了GegeHost已经有两年了，使用至今服务器只出过两三次问题，但都很快就解决了。空间使用的是cPanel面板，还带简体中文，简单方便易用，对新手都可以很快上手。速度那得看你用那里的机房了，美国的话适合做外贸的，日本的对国内和国外都不错，本人是强烈推荐香港机房的，对大陆访问速度好，又可以不用拍照备案。如果想跟我一样自建博客写日志，又或者想有更多了解的话，可以去<a rel="nofollow" href="http://client.gegehost.com/aff.php?aff=414" title="GegeHost" target="_blank">GegeHost</a>上看一下。现在购买还有.in域名赠送，欲购从速。</p>
<p><strong>PS：31号更换为日本空间，香港的主机性能限制太大了。</strong></p>
<div class="shengming">
<strong>声明:</strong> 本文遵循 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh" title="本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 Unported许可协议进行许可。" rel="license" target="_blank">BY-NC-SA 3.0</a> 协议. 转载请注明转自: <a rel="bookmark" title="博客更换GegeHost香港机房" href="http://hillboy.org/articles/blog-replacement-space.html">博客更换GegeHost香港机房</a><div class="fixed"></div></div>]]></content:encoded>
			<wfw:commentRss>http://hillboy.org/articles/blog-replacement-space.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.732 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-18 10:41:03 -->

