banner
AgedCoffee

AgedCoffee

Creating Your Reading Habits with RSS

What is RSS & What are the Benefits#

Really Simple Syndication (RSS) is a standard for aggregating and delivering content based on XML. It is widely used on the internet as a content packaging and delivery protocol. RSS (Really Simple Syndication) is a format for describing and synchronizing website content, and it is the most widely used XML application. RSS establishes a technological platform for rapid information dissemination, making everyone a potential information provider.

  • Essentially an XML file
  • XML contains some summary information about the current website
  • Can be subscribed to receive updates
  • Not constrained by specific platforms
  • Can aggregate different information sources using an RSS reader
  • No advertisements

Fluent-Reader for Desktop

fluent-reader

Ego-Reader for Mobile

ego-reader

How to Find RSS Feeds#

RSSHub#

RSSHub is an open-source, easy-to-use, and easily extensible RSS generator that can generate RSS feeds for any kind of content. RSSHub is rapidly developing with the help of the open-source community and currently supports thousands of content items from hundreds of websites.

XiTNAl

Assisting in Finding RSS Feeds on Websites#

Google Chrome Extension#

RSSHub Radar

ID50BU

Android App#

RSSAid

iOS App#

RSSBud

Checking if Your Favorite Blogs Have RSS Feeds#

7Qk29t

Recommended High-Quality Frontend Blogs

Adding RSS Feeds & Using RSS Readers#

Fluent-Reader
wBUg6e

sHQMCh

Ego-Reader
GvAWAS

fpXTH1

Deploying Your Own RSShub#

The official website provides many deployment methods, and it is recommended to use the fork code repository to deploy your own service on the free cloud platform provided by Vercel.

vercel

YFynGM

Adding RSS Feeds to Your Blog#

// Generate the necessary information for RSS feed items
const generateRssItem = (post) => `
  <item>
    <guid>${siteMetadata.siteUrl}/blog/${post.slug}</guid>
    <title>${escape(post.title)}</title>
    <link>${siteMetadata.siteUrl}/blog/${post.slug}</link>
    ${post.summary && `<description>${escape(post.summary)}</description>`}
    <pubDate>${new Date(post.date).toUTCString()}</pubDate>
    <author>${siteMetadata.email} (${siteMetadata.author})</author>
    ${post.tags && post.tags.map((t) => `<category>${t}</category>`).join('')}
  </item>
`

const generateRss = (posts, page = 'feed.xml') => `
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
      <title>${escape(siteMetadata.title)}</title>
      <link>${siteMetadata.siteUrl}/blog</link>
      <description>${escape(siteMetadata.description)}</description>
      <language>${siteMetadata.language}</language>
      <managingEditor>${siteMetadata.email} (${siteMetadata.author})</managingEditor>
      <webMaster>${siteMetadata.email} (${siteMetadata.author})</webMaster>
      <lastBuildDate>${new Date(posts[0].date).toUTCString()}</lastBuildDate>
      <atom:link href="${siteMetadata.siteUrl}/${page}" rel="self" type="application/rss+xml"/>
      ${posts.map(generateRssItem).join('')}
    </channel>
  </rss>
`

// For example, in Next.js, generate the feed.xml RSS feed file when generating the page
export async function getStaticProps({ params }) {
  const allPosts = await getAllFilesFrontMatter('blog')
  const postIndex = allPosts.findIndex((post) => formatSlug(post.slug) === params.slug.join('/'))
  const prev = allPosts[postIndex + 1] || null
  const next = allPosts[postIndex - 1] || null
  const post = await getFileBySlug('blog', params.slug.join('/'))
  const authorList = post.frontMatter.authors || ['default']
  const authorPromise = authorList.map(async (author) => {
    const authorResults = await getFileBySlug('authors', [author])
    return authorResults.frontMatter
  })
  const authorDetails = await Promise.all(authorPromise)

  // rss
  const rss = generateRss(allPosts)
  fs.writeFileSync('./public/feed.xml', rss)

  return { props: { post, authorDetails, prev, next } }
}

Translation:

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.