嗯…这两天花了不少一点时间更新了一下 Blog,这里稍微记录一下。

配色和样式调整

配色上的调整相信你已经看到了,总之…红黑配色赛高!(其实是红灰啦)

另外,如果你在 PC 的宽屏幕上浏览本 Blog,你会发现正文内容两侧有了一定留白,让阅读体验更佳。移动端不受此影响。同时,我对页面中标题、图片与段落之间的间距进行了微调,避免像之前那样过于紧凑。

RSS 全文输出

之前我提到过 Hugo 默认的 RSS 输出只提供摘要,想要阅读全文还是得跳转到原网页,或是使用 Mercury 等全文输出插件,很不方便。事实上,稍微修改一下 Hugo 默认的 RSS 模版就能实现全文输出。以下是自带的默认 RSS 模版:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
    <link>{{ .Permalink }}</link>
    <description>Recent content {{ if ne  .Title  .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
    <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
    <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
    <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
    <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
    <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
    {{ with .OutputFormats.Get "RSS" }}
        {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
    {{ end }}
    {{ range .Pages }}
    <item>
      <title>{{ .Title }}</title>
      <link>{{ .Permalink }}</link>
      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
      {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
      <guid>{{ .Permalink }}</guid>
      <description>{{ .Summary | html }}</description>
    </item>
    {{ end }}
  </channel>
  </rss>

要实现全文输出,我们只需要在 layouts/ 下建立一个 rss.xml 文件,复制上述模版并将 <description>{{ .Summary | html }}</description> 改成 <description>{{ .Content | html }}</description> 即可。

如果真的有人你使用 RSS 订阅本 Blog,相信这会带来更好的体验。

重写 Tags

之前的 Tags 有些重复,而且在 Tags 页面 里看上去也不太美观,于是重新分类整理了一下 Tags,并全部使用中文。

Something more…

还有些其他的事 —— 经过稍微的折腾,我把 Blog 的 web server 从 Apache 换成了 Nginx (嗯,没有为什么)。同时,经过另一番折腾,本 Blog 终于能正常显示 Hugo-nuo 主题自带的 404 页面了。你可以访问本 Blog 下一个不存在的网址(比如 这个)来查看这有趣的 404 页面。 如果你对上面的折腾过程有兴趣,我会在稍后写「借助 HyperApp & Hugo 搭建个人博客」一文时详细说说。