Webgen::SourceHandler::Feed

Summary

This source handler operates on paths that match one of the following path patterns (see the path pattern documentation for more information): **/*.feed

Following is the default meta information set on any node created by this source handler:

rss: true
atom: true
blocks: 
  default: 
    pipeline: erb

Description

This source handler automatically generates an atom or RSS feed for a set of files from a file in Webgen Page Format (the format which is also used for page files).

The following meta information keys are supported:

  • entries (MANDATORY)

    A LCN pattern (or an array of LCN patterns) which specify the page files that should be used. Other matched files are excluded from the list.

    Be aware that if you want to include a single file or files in a specific language only you need to include the language part since this is a LCN and not a CN pattern, eg. mypage.html won’t work but mypage.en.html will!

  • number_of_entries (OPTIONAL)

    The number of entries that should be included in the feed. Defaults to 10.

  • atom (OPTIONAL)

    An atom feed is generated if this key is set to true. Defaults to true. The generated file name derives from the feed file name but the extension is changed to atom.

  • rss (OPTIONAL)

    A RSS feed is generated if this key is set to true. Defaults to true. The generated file name derives from the feed file name but the extension is changed to rss.

  • rss_version (OPTIONAL)

    The RSS version that should be used for generating the RSS feed. Defaults to 2.0.

  • site_url (MANDATORY)

    The base url of the website for which the feed is generated.

  • author (MANDATORY)

    Specifies the author of the feed.

  • author_url (OPTIONAL)

    Specifies the URL of the homepage of the author.

  • title (MANDATORY)

    The title of the feed.

  • description (OPTIONAL)

    A short description of the feed.

  • created_at (OPTIONAL)

    The time at which this feed was created. Defaults to the current time if not set. Has the same format as the meta information created_at.

  • content_block_name (OPTIONAL)

    The name of the block that should be used for the content of the feed entries. If not specified the name content is used. Be aware that each page file that can appear in the feed needs to have such a block!

The following meta information keys of page files are used if they are specified:

  • created_at

    The time at which the page file was created, used as the publication time.

  • modified_at

    The time at which the page file was last modified, used as the time at which this feed entry was updated.

    This is the field that is used to sort the entries.

  • title

    The title of the page file, used as title of the feed entry.

  • author

    The name of the author of the page file, used as the author of the feed entry.

  • author_url

    The URL of the homepage of the author. Only used if the author meta information is also set.

The default implementation supports the generation of atom and RSS feeds by using templates shipped with webgen (the extension feed is changed to atom for atom feeds and to rss for rss feeds). The default templates are located under the ALCNs /templates/atom_feed.template and /templates/rss_feed.template and are automatically created and used if no such paths exist in the webgen website. You can also override the default generation mechanism on a file per file basis by adding an atom_template and/or rss_template block in the feed file which are then used to generate the atom or the RSS feed respectively.