Generate RSS Feeds that work well with Google News
npm install feed-core> Generate RSS Feeds that play nice with Google News
``sh`
npm install feed-core
The two main types provided are RSSFeed and FeedItem
To create a new RSS feed, the RSSFeed class can be used and takes
the following parameters:
`typescript`
const feed = new RSSFeed({
title: 'Awesome Feed about Cats and Dogs',
description: 'This is a feed about Cats vs Dogs',
link: 'https://cats-v-dogs.com/rss',
})
The rest of the feed properties that can be set are:
- feedAuthor: FeedAuthor:`
typescript`
const author = new FeedAuthor({
name: 'Giomari Martinez',
email: 'gigi@example.com'
link: 'giomari-m.com'
})
feed.feedAuthor = author
string[]
- categories: :`
typescript`
feed.categories = ['cats', 'dogs']
Date
- updatedAt: :`
typescript`
feed.updatedAt = new Date()
string
- language: `
typescript`
feed.language = 'en'
string
- image: `
This represents the image url for the feed:
typescript`
feed.image = 'https://example.com/cat-v-dogs.jpg'
Feed can be added to a feed's items property - an array of type FeedItem[]
Each item should follow the signature of FeedItem:
`typescript``
const feedImage = new FeedItemImage({
url: 'https://unsplash.com/photos/EV9_vVMZTcg', // Image url
width: 1280, // number - image width
height: 720, // number - image height
thumbnail: 'https://unsplash.com/photos/EV9_vVMZTcg', // (optional)image thumbnail url (optional)
description: '', // string (optional) - the image description
credit: '', // string (optional) - can be something like 'Image couretesy of Unsplash'
})
const feedItem = new FeedItem(
// Required
'In the subways, cats and dogs have to play nice', // the item title
'https://https://cats-v-dogs.com/where-it-all-began', // Link to the item
'A story of what really happened', // Item Summary/description
'The story begins', // Content
// Optional
new Date(), // (optional) the publication date of the item - defaults to new Date()
'https://https://cats-v-dogs.com/assets/where-it-all-began.jpg'[author], // (optional) FeedAuthor[] - authors
[author], // (optional) FeedAuthor[] - contributors
)
š¤ Laurence B. Ininda
- Website: https://laudebugs.me
- Twitter: @lbugasu
- Github: @lbugasu
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a āļø if this project helped you!
Copyright Ā© 2021 Laurence B. Ininda.
This project is ISC licensed.
---
_This README was generated with ā¤ļø by readme-md-generator_