Defaults
Your config/feedamic.php
file must have some defaults set.
These will automatically be used for each of your feeds, unless you explicitly override them in a feed's configuration
Default options
These options are more generic in nature, and can help simplify your actual feed configuration as you may have common patterns in these options that apply to all of your feeds.
summary
An array of field handles for Feedamic to use to find the content to use as the introduction.
1'summary' => [2 'introduction',3 'meta_description'4],
Feedamic will look for a matching field in the order they appear - so in the above example, Feedamic will look for the introduction
first, and if not found, will try the meta_description
next.
image
Allows for an image to be injected as part of the summary for readers that support image previews.
The fields
behave like summary - a cascading list of image fields to look at.
You can specify the width
and height
too to use for the image generation. If omitted, will fall back to be 1280 x 720.
1'image' => [2 'fields' => [3 'hero',4 'meta_og_image'5 ],6 'width' => 1280,7 'height' => 7208],
In this example, Feedamic will try to find the hero
field, and if not found, will try the meta_og_image
next.
You can disable image support by setting this to false
.
1'image' => false,
author
Prior to v2.2, only Users were supported as authors. v2.2 allows any Statamic content that is available as a DataCollection to be used, including Collections, Taxonomies and Users.
Sets the lookup of an author field.
Set to false
to disable looking for author details.
1'author' => false,
If used,
handle
defines the field handle to the author in your Entryemail
, when true, will output the<email>
for atom feedsname
, a pattern to use to build the name output
For name
, each handle is in square brackets, and is used to concatenate fields if you are using or want to customise the name output. For example, [name_first] [name_last]
would pick name_first
and name_last
from the matching item.
In this default example, Feedamic will look for the author
field in the Entry, output the <email>
element in an Atom feed, and set the author's name as the matching object's name
property.
1'author' => [2 'handle' => 'author',3 4 'email' => true,5 6 'name' => '[name]',7],
copyright
A string to output to the <copyright>
(RSS) or <rights>
(Atom) feed.
Set to false
to exclude this element.
language
Marks the feed as being in a specific language.
As Atom, using xml:lang
, can use more language definitions than the RSS specification, refer to the RSS specification for suitable codes:
https://www.rssboard.org/rss-language-codes
limit
Support for limit
has been added in v2.2.
By default, this is set to null
, meaning your feed will contain all Entries for the configured feed.
You can set this to an integer to limit the number of Entries included. These will be sorted by their published date.
In this example, the first 10 Entries will be included:
1'limit' => 10
locales
Support for locales
has been added in v2.2.3.
This is for use with multi-site to help filter different locales to different feeds (or to include/exclude).
By default, when set to null
, all locales will be included in your feeds.
You can set this to be an array of your configured locales (aka site key values in your config/statamic/sites.php
file) to use as the default for all feeds:
1'locales' => ['en', 'de']
To use the current locale only, set it to the special string value of current
:
1'locales' => 'current'
model New
Support for updating the feed entry model
was added in v2.4.0.
This allows you to define your own FeedEntry model if you need to override what it can do.
By default, this is Feedamic's own model, but you can set it to your own model too:
1'model' => \MityDigital\Feedamic\Models\FeedEntry::class
When you create your own FeedEntry
model, you will need to implement the FeedamicEntry
interface:
1class FeedEntry implements \MityDigital\Feedamic\Contracts\FeedamicEntry2{3 // ...4}
You will need to implement each of the interface's methods. View the interface details for more information.
Overriding for a feed
You can add any of these keys to your individual feed configuration sets too. This means you can use defaults across all of your site, and then override specific keys for specific feed as needed.