迁移到hugo,第三部分:可是我想要更多的feed地址…
2017年6月12日 22:25
之前在 http://heyeshuang.tk 这个域名下的时候,wordpress提供的RSS feed地址格式类似 http://heyeshuang.tk/feed/ ,但是hugo提供的RSS地址是index.xml
样子的,而且我翻遍了manual也没看到给RSS加alias的方法。
所以只能改模版了,思路是把/feed
目录的列表页渲染成RSS的样子,我是直接在主题里面改的:
\themes\<主题名字>\layouts\feed\list.html
:
<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...
剩余内容已隐藏
查看完整文章以阅读更多
迁移到hugo,第三部分:可是我想要更多的feed地址…
2017年6月12日 22:25
之前在 http://heyeshuang.tk 这个域名下的时候,wordpress提供的RSS feed地址格式类似 http://heyeshuang.tk/feed/ ,但是hugo提供的RSS地址是index.xml
样子的,而且我翻遍了manual也没看到给RSS加alias的方法。
所以只能改模版了,思路是把/feed
目录的列表页渲染成RSS的样子,我是直接在主题里面改的:
\themes\<主题名字>\layouts\feed\list.html
:
<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...
剩余内容已隐藏
查看完整文章以阅读更多