本文简介如何为 hugo 博客添加 rss 。
hugo 具有自带的rss 功能1,在 hugo.toml
中添加如下代码,启用hugo的rss生成。
[outputs]
home = ['html', 'rss']
section = ['html', 'rss']
taxonomy = ['html']
term = ['html']
# 以下为版权声明与作者信息,请自行更改对应字符串
copyright = "©版权信息"
languageCode = "zh-cn"
[Author]
name = "YOUR_NAME"
email = "me@example.com"
而后在layouts/partials/header.html
的 <head>
标签中添加如下字段:
<link rel="alternate"
type="application/rss+xml"
href="{{.Site.BaseURL }}/index.xml"
title="{{ .Site.Title }}">
此时浏览器的rss插件即可找到rss订阅链接。
对于默认生成的rss,其只生成摘要,而且默认监视所有页面的变化,如果需要生成全部内容的rss,或者修改为监视 content\posts
下文章的变化,请参考此处2。