最后更新于

Hugo禁用输出RSS

分类: golang
标签: hugo

Hugo的RSS会让Google产生各种错误提示,所以打算禁用RSS。Hugo禁用RSS方法如下:

修改Hugo.toml文件

#[outputs]
#  home = ["HTML", "RSS"]
#  page = ["HTML", "MarkDown"]
#  section = ["HTML", "RSS"]
#  taxonomy = ["HTML", "RSS"]
#  taxonomyTerm = ["HTML"]

[outputs]
  home = ["HTML"]
  page = ["HTML"]
  section = ["HTML"]
  taxonomy = ["HTML"]
#  taxonomyTerm = ["HTML"]

如果使用even主题会报错,还需要修改themes/even/layouts/partials/footer.html,去掉

  {{ if .Site.LanguagePrefix -}}
  <a href="{{ .Site.LanguagePrefix | absURL }}/index.xml" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a>
  {{- else -}}
  <a href="{{ .Site.RSSLink }}" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a>
  {{- end }}