@notiz/scully-plugin-rss

1.2.0 • Public • Published

scully-plugin-rss

npm version

scully-plugin-rss is a routeDiscoveryDone plugin for Scully. A RSS Feed is created from your content using feed and showdown.

The rss feed is available at:

  • your-domain.de/feed.json
  • your-domain.de/feed.atom
  • your-domain.de/feed.xml

To change the filename of the feed, use the filename attribute in your rss.config.json file, as seen below. The default value is feed, but you can change it to whatever you'd like.

Breaking Change introduced in Version 1.0.0 with changing the plugin type from render to routeDiscoveryDone. This has the major benefit of only generating the RSS Feed once per run instead of after each page render.

📦 Installation

Install the RSS Feed plugin using the command

npm install @notiz/scully-plugin-rss --save-dev

Note: routeDiscoveryDone plugin requires @scullyio/scully in version ^1.0.5 or above to correctly parse date values from markdown front matter.

Usage

Import the plugin in the Scully config file scully.app-name.config.ts:

import { ScullyConfig } from '@scullyio/scully';
import '@notiz/scully-plugin-rss';

export const config: ScullyConfig = {
  projectRoot: './src/app',
  routes: {
    ...
  },
};

It will run on only routes that include /blog unless specified otherwise in the rss.config.json file. The order of the posts will be oldest first unless the newestPostsFirst option is set in the config.

Create a rss.config.json in your root with the following properties:

{
  "title": "Your Title",
  "description": "Page description",
  "id": "https://your-domain.com",
  "link": "https://your-domain.com",
  "language": "en",
  "image": "https://your-domain.com/featured.png",
  "favicon": "https://you-domain.com/favicon.png",
  "copyright": "2020 your-domain.com",
  "generator": "Page description",
  "filename": "feed",
  "feedLinks": {
    "atom": "https://your-domain.com/feed.atom",
    "json": "https://your-domain.com/feed.json",
    "xml": "https://your-domain.com/feed.xml"
  },
  "outDir": "./dist/static",
  "categories": ["Categories", "of", "your", "choice"],
  "blogPostRouteSlug": "/blog",
  "newestPostsFirst": true
}

Each RSS Feed item attributes are currently assigned by the following scully route attributes.

RSS Feed Item Scully Route
title title
id slug
link Config Link + slug
description description
content articleHTML
author authors
contributor authors
date updatedAt |  publishedAt

Your content should have the following front matter in your scully content:

---
title: Martial Arts Training
description: Best Martial Arts Training
publishedAt: 2020-03-25T10:12:00.000Z
updatedAt: 2020-03-25T10:12:00.000Z
published: true
tags:
  - training
  - rss
authors:
  - Bruce Lee
---

Readme

Keywords

Package Sidebar

Install

npm i @notiz/scully-plugin-rss

Weekly Downloads

4

Version

1.2.0

License

MIT

Unpacked Size

8.09 kB

Total Files

4

Last publish

Collaborators

  • garygrossgarten
  • marcjulian