mkdocs RSS / Atom Feed¶
目的:为文档加 RSS / Atom feed 关联:[B1-6]
1. 插件¶
mkdocs-material 自带 RSS 支持:
- material/feed plugin
2. 3 步配置¶
2.1 Step 1: 配置¶
# mkdocs.yml
plugins:
- feed:
# 输出位置
feed_url: feed_rss_updated.xml
match_path: ".*" # 哪些 path 进 feed
date_format: "%Y-%m-%d"
5 行。
2.2 Step 2: frontmatter¶
date + description 必填。
2.3 Step 3: 输出¶
/feed_rss_updated.xml —— 用户订阅。
3. 5 个 feed 类型¶
| Type | 用途 |
|---|---|
| RSS 2.0 | 老标准 |
| Atom 1.0 | 新标准 |
| JSON Feed | 程序员友好 |
| RSS updated | 最近修改 |
| RSS full | 全部 |
5 类型。
4. 5 个最佳实践¶
- 最近 N 篇 —— 不要全量
- 含 description —— 摘要
- 含 date —— 时间戳
- 含 author —— 归属
- HTML 净化 —— 安全
5. 总结¶
RSS = feed plugin + 3 步配置 + 5 类型。
下一步: - 看 B1-7 social links