# cnBolt-Extensions-Feed extension for generating feeds by twig-templates ## Installation Add the extension to `extensions/composer.json "repositories": { "cnd/feed": { "type": "vcs", "url": "https://github.com/CondeNastDigital/cnBolt-Extensions-Feed.git" } }, "require": { "cnd/feed": "*" } Run `composer update`. ## Configuration Edit the extensions config file: `app/config/extensions/feed.cnd.yml` feeds: - route: /feed/latest input: select # default value if not set select: contenttypes: [articles] limit: 100 content: title: Titel description: Beschreibung link: URL language: de maxAge: 3600 headers: "Content-Type": "application/rss+xml;charset=UTF-8" template: @cndfeed/rss/list.twig **Controller settings** * route: the path to the rss feed * input: `select` or `relationlist` to select content selection methods * template: path/to/twig/template * content: various parameters used inside the rendering templates * title: feed title * description: feed description * link: URL to the website **Select Input** * select: values sent to selectcontent engine. See cns/basics for specs **Relationlist Input** * pool: relationlist pool to select content from (can also be array with `search` and `fill` properties) * count: number of elements to return (it will allways at least the fixed elements, if any!) * parameters: Parameter array to use with pool filters * contenttype: Optional contenttype to get fixed elements from * field: Optional relationlist field to get fixed elements from ### ContentApi Format The configuration for the contentapi format is a bit more complex. You need a map for each attribute and contenttype in `settings.map.`. The list keyx is the target field of the contentApi format, the value is one of: - A simple field name of the Bolt contenttype - An array of simple field names (The processor will use the first field with a value) - An object with `type`, `key` and `config` - type: `field` for a simple field, `taxonomy` for a taxonomy field, `relation` for a value of a relatedlist item, `selectsingle` for a value of a bolt select item - key: the bolt field to use - config: any possible configuration for this type - A Static Map to map a field value according to a value of another field. - sections_ignore: articles with this sections are exportet without this sections (defaults defined in BaseProcessor) Sample: ``` - route: /api/feed/latest select: contenttypes: [articles] limit: 10 offset: 0 processors: [ContentApi\Processor, ContentApi\HoroscopeProcessor, ContentApi\CompetitionProcessor, ContentApi\CallbackProcessor] settings: types: [] # callback processor call the a class method to get the value of a field. callback: horoscope: teaser.title: &horoscope-placeholders class: CND\Horoscopes\Service\Frontend method: getFeedString teaser.kicker: *horoscope-placeholders teaser.abstract: *horoscope-placeholders map: article: teaser.title: [title,metatitle] teaser.abstract: [teasertext,metadescription,intro] teaser.image: [teaserimage, image] meta.title: [metatitle,title] meta.description: [metadescription,teasertext,intro] meta.image: [teaserimage, image] meta.tags: {type: taxonomy, key: tags} meta.category: {type: taxonomy, key: categories} content.title: title content.kicker: kicker content.abstract: intro content.author: {type: selectsingle, key: authors, config: {contenttype: authors}} content.sections: text horoscope.type: type: static-map key: type config: map: tageshoroskop: daily wochenhoroskop: weekly monatshoroskop: monthly jahreshoroskop: yearly sections_ignore: [] maxAge: 3600 template: @cndfeed/contentapi/list.twig ``` list of configuration values: - foreignkey -> {foreignkey: slug} - contenttype -> {contenttype: authors} - field -> {field: name}