RSS 订阅
如何配置 RSS 订阅,让读者可以通过 RSS 阅读器追更
Hey,同学!想让读者用 RSS 阅读器追更你的博客吗?这一篇教你配置 RSS 订阅~ 📻
🤔 什么是 RSS?
RSS (Really Simple Syndication) 是一种让读者「订阅」网站内容的技术。
不用每次都去网站看更新,RSS 阅读器会自动拉取最新内容。
💡 想象一下:RSS 就像是「报纸订阅」—— 每天自动送到家,不用自己去买!
🔧 配置
自动生成
iFluxArt 会自动生成 RSS feed:
| 地址 | 内容 |
|---|---|
/feed.xml | 全部文章 |
/feed.xml?category=前端 | 前端分类文章 |
/feed.xml?tag=React | React 标签文章 |
文件位置
生成的逻辑在:
text
apps/blog/src/app/feed.xml/route.ts
📖 使用方式
1. 在浏览器中查看
直接访问 https://your-blog.com/feed.xml,会看到类似:
xml
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>我的博客</title>
<link>https://myblog.com</link>
<description>技术博客</description>
<item>
<title>第一篇文章</title>
<link>https://myblog.com/posts/first-post</link>
<description>文章摘要...</description>
<pubDate>2024-01-15T00:00:00Z</pubDate>
</item>
</channel>
</rss>
2. 添加到 RSS 阅读器
常见 RSS 阅读器:
| 阅读器 | 平台 | 说明 |
|---|---|---|
| Feedly | Web/iOS/Android | 最流行 |
| Inoreader | Web/iOS/Android | 功能强大 |
| NetNewsWire | macOS/iOS | 简洁美观 |
| Reeder | macOS/iOS | 付费但好用 |
| Fluent Reader | Windows | 开源免费 |
添加方式:在阅读器中输入你的 RSS 地址即可!
🎨 优化 RSS 内容
自定义标题
typescript
// route.ts
const feed = new RSS({
title: '我的技术博客',
description: '分享前端技术和思考',
site_url: 'https://myblog.com',
feed_url: 'https://myblog.com/feed.xml',
});
包含更多内容
可以配置包含:
- 全文或摘要
- 作者信息
- 分类/标签
- 封面图
📡 多平台同步
同步到社交平台(待实现)
- 自动同步到 Twitter
- 自动同步到微博
- 自动同步到掘金
Ping 更新
可以配置「Ping」服务,通知搜索引擎更新:
| 服务 | 地址 |
|---|---|
| https://blogsearch.google.com/ping | |
| Bing | https://www.bing.com/ping |
| 百度 | http://ping.baidu.com/ping |
💡 最佳实践
1. 启用全文还是摘要?
- 摘要:读者需要点击链接访问网站,流量更高
- 全文:阅读体验更好,但可能影响网站访问量
建议:摘要,引导回网站!
2. 包含封面图
在 RSS 中添加封面图,让内容更丰富:
typescript
item({
title: post.title,
description: post.summary,
url: post.url,
enclosure: {
url: post.cover,
type: 'image/jpeg',
},
});
3. 定期检查
确保 RSS 正常工作:
- 访问
/feed.xml检查格式 - 用 Feed Validator 检查
- 测试阅读器能否正常解析
📊 统计
RSS 订阅者数量可以通过:
- Feedburner 等服务统计
- 阅读器提供的统计(部分支持)
🔗 下一步
📡 RSS 是「老派」但好用的技术!现在依然有大量用户在用 RSS 追更博客~