mitydigital / statamic-feedamic

An Atom and RSS feed for Statamic 3, 4 and 5
https://docs.mity.com.au/feedamic
8 stars 9 forks source link

Only receiving first collection from config #15

Closed spaceageliving closed 1 year ago

spaceageliving commented 1 year ago

Bug description

Using the following config, I am only getting items from the first collection in the 'collections' array (equipment):

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Feeds
    |--------------------------------------------------------------------------
    |
    | Ability to define Atom and RSS feed routes.
    |
    | You can create as many feeds as you like in the key:value setup, and even
    | override some defaults (or use defaults) to make your config simpler.
    |
    | The key is used as a reference to your feed, and is used as part of the
    | cache key for the feed.
    |
    */

    'feeds' => [
        'blog' => [
            /*
            | The title for the feed
            */
            'title' => 'Tracking Angle',

            /*
            | The description (RSS) or subtitle (Atom) for the feed
            */
            'description' => 'Featuring music reviews spanning all genres and formats with an emphasis on vinyl records but also including digital streams and downloads, CDs, SACDs, and maybe even a cassette or two',

            /*
            | Define the Atom and RSS routes for the feed.
            | By default, an atom and RSS 2.0 feed will be generated.
            | Remove from the array to disable a specific feed type.
            */
            'routes' => [
                'atom' => '/feed/atom',
                'rss' => '/feed'
            ],

            /*
            | The alternative link used. If omitted, will be the app.url value - which is fine too
            */
            'alt_url' => '',

            /*
            | An array of collections to include in the feed
            | Remove from the array to disable a specific feed type.
            */
            'collections' => [
                'equipment',
                'features',
                'music_reviews'
            ],

            /*
            | You can also override the following configuration for feed-specific
            | values:
            |   - author
            |   - copyright
            |   - image
            |   - language
            |   - limit
            |   - summary
            */
            /*
            For example, this summary would only apply to this feed:
            'summary' => [
                'short_intro',
                'introduction'
            ],

            Or, only allowing 10 entries to be returned for a specific feed
            'limit' => 10
             */

        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Cache Key
    |--------------------------------------------------------------------------
    |
    | The base cache key for output.
    |
    | Will be cached forever until EventSaved is fired, or you manually clear the cache.
    |
    */

    'cache' => 'feedamic',

    /*
    |--------------------------------------------------------------------------
    | DEFAULTS: Summary
    |--------------------------------------------------------------------------
    |
    | This is the default that applies to all configured 'feeds', unless overwritten
    | for a specific feed configuration.
    |
    | A list of blueprint fields to look at to try to build the "summary" for the feed.
    |
    | This is ordered - the first field will be looked first, then the second, etc.
    |
    | When content is found, it will be used, and other fields will be ignored.
    |
    */

    'summary' => [
        //'title',
        'subhead',
        'subtitle'
    ],

    /*
    |--------------------------------------------------------------------------
    | DEFAULTS: Image
    |--------------------------------------------------------------------------
    |
    | This is the default that applies to all configured 'feeds', unless overwritten
    | for a specific feed configuration.
    |
    | Configuration options for the image to be injected in to the "summary" for the entry.
    |
    | This only applies when Summary is being used.
    |
    | 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 be 1280 x 720.
    |
    | Disable this by setting to false.
    |
    */

    'image' => [
        'fields' => [
            'main_image'
        ],
        'width' => 1280,
        'height' => 720
    ],

    /*
    |--------------------------------------------------------------------------
    | DEFAULTS: Author
    |--------------------------------------------------------------------------
    |
    | This is the default that applies to all configured 'feeds', unless overwritten
    | for a specific feed configuration.
    |
    | Sets the lookup of an author field.
    |
    | Set to "false" to disable looking for author details.
    |
    | If used,
    |   "handle" defines the blueprint reference to the author, a Statamic user
    |   "email", when true, will output the <email> for atom feeds
    |   "name", 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 User.
    |
    */

    'author' => [
        'handle' => 'author',

        // true to include the email in the feed, false to exclude - atom only
        'email' => false,

        // the name pattern to use for the author name
        'name' => '[name]',
    ],

    /*
    |--------------------------------------------------------------------------
    | DEFAULTS: Copyright
    |--------------------------------------------------------------------------
    |
    | This is the default that applies to all configured 'feeds', unless overwritten
    | for a specific feed configuration.
    |
    | A string to output to the <copyright> (RSS) or <rights> (Atom) feed.
    |
    | False will exclude this element.
    |
    */

    'copyright' => false,

    /*
    |--------------------------------------------------------------------------
    | DEFAULTS: Language
    |--------------------------------------------------------------------------
    |
    | This is the default that applies to all configured 'feeds', unless overwritten
    | for a specific feed configuration.
    |
    | 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
    |
    */

    'language' => 'en',

    /*
    |--------------------------------------------------------------------------
    | DEFAULTS: Limit
    |--------------------------------------------------------------------------
    |
    | This is the default that applies to all configured 'feeds', unless overwritten
    | for a specific feed configuration.
    |
    | Limits the number of entries returned in a feed.
    |
    */

    'limit' => 100
];

Steps to reproduce

Use the above config.

Environment and versions

Statamic 3.4.6 Pro
Laravel 8.83.27
PHP 8.1.17
Stache Watcher Disabled
Static Caching Disabled
aerni/social-links 2.3.1
mitydigital/feedamic 2.2.3
stillat/meerkat 2.6.2

Additional details

No response

martyf commented 1 year ago

Can you please provide a repo with the issue?

Having multiple collections configured is working correctly here.

Have you tried clearing the cache after updating your config too?

php please feedamic:clear
spaceageliving commented 1 year ago

Thanks @martyf. Just tried clearing cache, no luck.

To provide repo, should I just give you access to the repo via GH?

I was considering moving the config file format to a single feed format as shown in docs because we don't need multiple feeds. Might this help in your opinion?

spaceageliving commented 1 year ago

@martyf I may also be misunderstanding the limit parameter. Does this mean the most recent X items per collection will be presented?

martyf commented 1 year ago

limit controls how many entries in total are returned. If you have 10 from "equipment" and 10 from "features", that's 20 total, your feed will only return the first 10 by date.

Not sure if you've seen it, but all the options are here.

If you want to return all entries, remove the limit option.

If that doesn't work, I'll need to see the repo to see what's going on.

spaceageliving commented 1 year ago

Let me try removing limit and see what happens…..

martyf commented 1 year ago

Don't forget to clear the cache too after changing your config. Note that when editing entries, the cache gets cleared for you, but Feedamic doesn't know when your config is different.

spaceageliving commented 1 year ago

@martyf Removing the limit did the trick. Thanks for your support!

martyf commented 1 year ago

I'm glad that helped out :)