hurrymaplelad / docpad-plugin-rss

Generates an RSS feed for a collection of documents
Other
10 stars 6 forks source link

Make channels configurables #4

Closed evantill closed 1 year ago

evantill commented 10 years ago

With this modifications you can configure (but not required) which content will be used for generating the rss channel.

For example we can use document content with layout for the description or use the mtime for the item date.

By default, the generated content is still the same as before this PR.

A full configuration will be

      default:
        collection: 'html'
        url: '/rss.xml'
        maxItems: 10
        channel:
          title: (templateData) -> templateData.site.title
          description: (templateData) -> templateData.site.description
          pubDate: (templateData) -> templateData.site.date
          author: (templateData) -> templateData.site.author
        item:
          title: (document) -> document.title
          description: (document) -> document.contentRenderedWithoutLayouts
          date: (document) -> document.date
          author: (document) -> document.author
hurrymaplelad commented 10 years ago

@evantill looks great! Mind updating the readme?

I'm leaning towards not deprecating the old configuration style, instead supporting both. I'm guessing a single feed is the most common case. The extra default key feels a little arbitrary when it has no peers. Thoughts?

evantill commented 10 years ago
default:
  maxItems: 5
channel2:
  item:
    description: (document) -> document.contentRendered

is the same as

default:
  collection: 'html'
  url: '/rss.xml'
  maxItems: 10
  channel:
    title: (templateData) -> templateData.site.title
    description: (templateData) -> templateData.site.description
    pubDate: (templateData) -> templateData.site.date
    author: (templateData) -> templateData.site.author
  item:
    title: (document) -> document.title
    description: (document) -> document.contentRenderedWithoutLayouts
    date: (document) -> document.date
    author: (document) -> document.author
channel2:
  collection: 'html'
  url: '/rss.xml'
  maxItems: 5
  channel:
    title: (templateData) -> templateData.site.title
    description: (templateData) -> templateData.site.description
    pubDate: (templateData) -> templateData.site.date
    author: (templateData) -> templateData.site.author
  item:
    title: (document) -> document.title
    description: (document) -> document.contentRendered
    date: (document) -> document.date
    author: (document) -> document.author
hurrymaplelad commented 10 years ago

Default key makes lots of sense when there are multiple channels configured. Just want to make sure the simple case stays simple. Multiple configuration styles add a little complexity, but I think two readme examples should cover it.

With the deprecation warning gone, lgtm. Thanks for workin on this!

On Feb 3, 2014, at 2:06 AM, Eric Vantillard notifications@github.com wrote:

I will remove the warning log to keep the current configuration. The extra default key is arbitrary but I have no better ideas. Any other options are welcome. Default configuration is used as a base configuration for all channels. Considering the previous example, this configuration default: maxItems: 5 channel2: item: description: (document) -> document.contentRendered is the same as

default: collection: 'html' url: '/rss.xml' maxItems: 10 channel: title: (templateData) -> templateData.site.title description: (templateData) -> templateData.site.description pubDate: (templateData) -> templateData.site.date author: (templateData) -> templateData.site.author item: title: (document) -> document.title description: (document) -> document.contentRenderedWithoutLayouts date: (document) -> document.date author: (document) -> document.author channel2: collection: 'html' url: '/rss.xml' maxItems: 5 channel: title: (templateData) -> templateData.site.title description: (templateData) -> templateData.site.description pubDate: (templateData) -> templateData.site.date author: (templateData) -> templateData.site.author item: title: (document) -> document.title description: (document) -> document.contentRendered date: (document) -> document.date author: (document) -> document.author When we are done with all the implementation details I will try to prepare some updates for the Readme. — Reply to this email directly or view it on GitHub.

evantill commented 10 years ago

Perfect, I will update my PR. I hope to do it before end of the week.

marisks commented 7 years ago

Any updates on this? Would like to have a description rendered in RSS. :)

evantill commented 1 year ago

obsolete