Skip to content

laudebugs/feed-core

Folders and files

NameName
Last commit message
Last commit date
Dec 9, 2021
Dec 9, 2021
Dec 10, 2021
Dec 26, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 9, 2021
Dec 10, 2021
Dec 9, 2021
Feb 17, 2022
Dec 26, 2021
Dec 9, 2021

Repository files navigation

Welcome to feed-core πŸ‘‹

Version Documentation Maintenance License: ISC Twitter: lbugasu

Generate RSS Feeds that play nice with Google News

🏠 Homepage

Install

npm install feed-core

Usage

The two main types provided are RSSFeed and FeedItem

Constructing a Feed

To create a new RSS feed, the RSSFeed class can be used and takes the following parameters:

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:
        const author = new FeedAuthor({
          name: 'Giomari Martinez',
          email: '[email protected]'
          link: 'giomari-m.com'
        })
        feed.feedAuthor = author
  • categories: string[]:
    feed.categories = ['cats', 'dogs']
  • updatedAt: Date:
    feed.updatedAt = new Date()
  • language: string
    feed.language = 'en'
  • image: string This represents the image url for the feed:
    feed.image = 'https://example.com/cat-v-dogs.jpg'

Adding Feed Items

Feed can be added to a feed's items property - an array of type FeedItem[]

Each item should follow the signature of FeedItem:

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
)

Author

πŸ‘€ Laurence B. Ininda

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

Copyright Β© 2021 Laurence B. Ininda.
This project is ISC licensed.


This README was generated with ❀️ by readme-md-generator