docpad-plugin-rss icon indicating copy to clipboard operation
docpad-plugin-rss copied to clipboard

Make channels configurables

Open evantill opened this issue 11 years ago • 5 comments

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

evantill avatar Jan 29 '14 13:01 evantill

@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?

hurrymaplelad avatar Feb 02 '14 23:02 hurrymaplelad

  • 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.

evantill avatar Feb 03 '14 10:02 evantill

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 [email protected] 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.

hurrymaplelad avatar Feb 03 '14 17:02 hurrymaplelad

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

evantill avatar Feb 04 '14 07:02 evantill

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

marisks avatar Jun 09 '17 04:06 marisks

obsolete

evantill avatar Feb 10 '23 10:02 evantill