添加 RSS 源
Get ready to…
-
安装 Astro 包来为你的网站创建 RSS 源
-
创建可供 RSS 提要阅读器订阅和阅读的提要
安装 Astro 的 RSS 包
Section titled 安装 Astro 的 RSS 包¥Install Astro’s RSS package
Astro 提供了一个自定义包来快速将 RSS 源添加到你的网站。
¥Astro provides a custom package to quickly add an RSS feed to your website.
此官方软件包会生成一个非 HTML 文档,其中包含有关你所有博客文章的信息,这些信息可以通过 Feedly、The Old Reader 等订阅阅读器读取。每次重建站点时都会更新此文档。
¥This official package generates a non-HTML document with information about all of your blog posts that can be read by feed readers like Feedly, The Old Reader, and more. This document is updated every time your site is rebuilt.
个人可以在提要阅读器中订阅你的提要,并在你在网站上发布新博客文章时收到通知,这使其成为一种流行的博客功能。
¥Individuals can subscribe to your feed in a feed reader, and receive a notification when you publish a new blog post on your site, making it a popular blog feature.
-
Quit the Astro development server and run the following command in the terminal to install Astro’s RSS package.
-
Restart the dev server to begin working on your Astro project again.
创建 .xml
feed 文档
Section titled 创建 .xml feed 文档¥Create an .xml
feed document
-
Create a new file in
src/pages/
calledrss.xml.js
-
Copy the following code into this new document. Customize the
title
anddescription
properties, and if necessary, specify a different language incustomData
: -
Add the
site
property to the Astro config with your site’s own unique Netlify URL. -
Visit
http://localhost:4321/rss.xml
and verify that you can see (unformatted) text on the page with anitem
for each of your.md
files. Each item should contain blog post information such astitle
,url
, anddescription
.
¥Checklist
¥Resources
Tutorials