1.1.6 ā€¢ Published 2 years ago

feed-core v1.1.6

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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: 'gigi@example.com'
          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

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

0.0.1

2 years ago