GenerateFeeds Wyam.Feeds

Generates syndication feeds including RSS, Atom, and RDF.
Each input document represents an item in the feed, up to the specified maximum number of documents. Note that documents will be used in the order in which they are input into this module, so a OrderBy module or similar should be used to order the documents prior to this module. You should also set the
Settings.Host
value in your configuration file since that's used to create the absolute links for feed readers. This module outputs a document for each of the selected feed types. Input documents are not output by this module.

Package

This module exists in the Wyam.Feeds package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.Feeds
Alternatively, you can add all modules at once with the following preprocessor directive:
#n Wyam.All

Usage

  • GenerateFeeds()

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • MaximumItems(int maximumItems)

    Sets how many items the feed will contain. The default value is 20. Note that documents will be used in the order in which they are input into this module, so a OrderBy module or similar should be used to order the documents prior to this module.

    • maximumItems

      The maximum number of items.

  • WithAtomPath(ContextConfig atomPath)

    Sets the path to the generated Atom file. The default behavior is to generate a RSS feed with a path of "feed.atom".

    • atomPath

      A delegate that should return a Wyam.Common.IO.FilePath for the Atom path. If the delegate is null or returns null, no Atom file will be generated.

  • WithFeedAuthor(ContextConfig feedAuthor)

    Sets the feed author. The default value is the value for the "Author" key in the global metadata.

    • feedAuthor

      A delegate that should return a string with the feed author.

  • WithFeedCopyright(ContextConfig feedCopyright)

    Sets the feed copyright. The default value is the value for the "Copyright" key in the global metadata.

    • feedCopyright

      A delegate that should return a string with the feed copyright.

  • WithFeedDescription(ContextConfig feedDescription)

    Sets the feed description. The default value is the value for the "Description" key in the global metadata.

    • feedDescription

      A delegate that should return a string with the feed description.

  • WithFeedId(ContextConfig feedId)

    Sets the feed identifier. The default value is a link to the site.

    • feedId

      A delegate that should return a Uri with the feed identifier.

  • WithFeedImageLink(ContextConfig feedImageLink)

    Sets the feed image link. The default value is the value for the "Image" key in the global metadata.

    • feedImageLink

      A delegate that should return a Uri with the feed image link.

  • WithFeedLink(ContextConfig feedLink)

    Sets the feed image link. The default value is the site link.

    • feedLink

      A delegate that should return a Uri with the feed link.

  • WithFeedPublished(ContextConfig feedPublished)

    Sets the feed published time. The default value is the current UTC time.

    • feedPublished

      A delegate that should return a DateTime with the feed published time.

  • WithFeedTitle(ContextConfig feedTitle)

    Sets the feed title. The default value is the value for the "Title" key in the global metadata.

    • feedTitle

      A delegate that should return a string with the feed title.

  • WithFeedUpdated(ContextConfig feedUpdated)

    Sets the feed updated time. The default value is the current UTC time.

    • feedUpdated

      A delegate that should return a DateTime with the feed updated time.

  • WithItemAuthor(DocumentConfig itemAuthor)

    Sets the item author. The default value is the value for the "Author" key in the input document.

    • itemAuthor

      A delegate that should return a string with the item author.

  • WithItemContent(DocumentConfig itemContent)

    Sets the content of the item. The default value is the value for the "Content" key in the input document. Note that the entire document content is not used because it will most likely contain layout, scripts, and other code that shouldn't be part of the feed item.

    • itemContent

      A delegate that should return a string with the content of the item.

  • WithItemDescription(DocumentConfig itemDescription)

    Sets the item description. The default value is the value for the "Description" key in the input document.

    • itemDescription

      A delegate that should return a string with the item description.

  • WithItemId(DocumentConfig itemId)

    Sets the item identifier. The default value is the absolute link to the input document.

    • itemId

      A delegate that should return a Uri with the item identifier.

  • WithItemImageLink(DocumentConfig itemImageLink)

    Sets the item image link. The default value is the value for the "Image" key in the input document.

    • itemImageLink

      A delegate that should return a Uri with the item image link.

  • WithItemLink(DocumentConfig itemLink)

    Sets the item link. The default value is the absolute link to the input document.

    • itemLink

      A delegate that should return a Uri with the item link.

  • WithItemPublished(DocumentConfig itemPublished)

    Sets the item published time. The default value is the value for the "Published" key in the input document.

    • itemPublished

      A delegate that should return a DateTime with the item published time.

  • WithItemThreadCount(DocumentConfig itemThreadCount)

    Sets the item thread count. By default, no thread count is specified.

    • itemThreadCount

      A delegate that should return an int with the item thread count.

  • WithItemThreadLink(DocumentConfig itemThreadLink)

    Sets the item thread link. By default, no thread link is specified.

    • itemThreadLink

      A delegate that should return a Uri with the item thread link.

  • WithItemThreadUpdated(DocumentConfig itemThreadUpdated)

    Sets the item thread updated. By default, no thread updated time is specified.

    • itemThreadUpdated

      A delegate that should return a DateTime with the item thread updated time.

  • WithItemTitle(DocumentConfig itemTitle)

    Sets the item title. The default value is the value for the "Title" key in the input document.

    • itemTitle

      A delegate that should return a string with the item title.

  • WithItemUpdated(DocumentConfig itemUpdated)

    Sets the item updated time. The default value is the value for the "Updated" key in the input document.

    • itemUpdated

      A delegate that should return a DateTime with the item updated time.

  • WithRdfPath(ContextConfig rdfPath)

    Sets the path to the generated RDF file. The default behavior is not to generate a RDF feed.

    • rdfPath

      A delegate that should return a Wyam.Common.IO.FilePath for the RDF path. If the delegate is null or returns null, no RDF file will be generated.

  • WithRssPath(ContextConfig rssPath)

    Sets the path to the generated RSS file. The default behavior is to generate a RSS feed with a path of "feed.rss".

    • rssPath

      A delegate that should return a Wyam.Common.IO.FilePath for the RSS path. If the delegate is null or returns null, no RSS file will be generated.

Input Metadata

The metadata values listed below apply to individual documents and are typically set from front matter (with just the name of the key) and used as inputs to the module to control behavior.

  • FeedKeys.Author: System.String

    The default metadata key for getting the author of feed items.

  • FeedKeys.Content: System.String

    The default metadata key for getting the content of feed items.

  • FeedKeys.Copyright: System.String

    The default metadata key for getting the copyright of feed items.

  • FeedKeys.Description: System.String

    The default metadata key for getting the description of feed items.

  • FeedKeys.Excerpt: System.String

    The default metadata key for getting the excerpt of feed items. The exceprt is typically only used for the feed item if a description is not provided.

  • FeedKeys.Image: System.String

    The default metadata key for getting the image of feed items.

  • FeedKeys.Published: System.String

    The default metadata key for getting the published date of feed items.

  • FeedKeys.Title: System.String

    The default metadata key for getting the title of feed items.

  • FeedKeys.Updated: System.String

    The default metadata key for getting the updated date of feed items.

Output Metadata

The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.

  • Keys.RelativeFilePath: Wyam.Common.IO.FilePath

    Relative path to the output feed file.

  • Keys.WritePath: Wyam.Common.IO.FilePath

    The path to use when writing the file.

GitHub