Filtering content

Warning another newbie question, but it is not clear to me who handles this (grav, php, twig, theme, etc). If I take the Blog example in the Antimatter Theme, when I click on a Tag for a blog item listing, it changes the url:

blog/tag:journal

and now I only get a listing of blogs that have that tag in it’s yaml file.

Where is this code that ignores the MD files in the pages/blog folder that do not meet that criteria? I want to mimic that same behavior for other content types (documents, samples, guides, tutorials, videos) and am trying to figure out my best file/folder structure.

That logic is handled transparently by Grav in the Page->collection() method, specifically this bit where it removes pages that don’t meed the criteria set by the taxonomy params in the URL: https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Page/Page.php#L1866-L1884

Is is possible to disable this auto-magic filtering of collections? I have a project where I use collections extensively but not every collection display should be modifiable externally via a simple URL parameter.

I even wasn’t aware of the auto-filtering until I looked at the source code of the collection() function.

Basically every non-modular collection in a Grav site can be filtered via the URL.
Could we have something like:

content:
  items:
    @self.children
    allow_taxonomy_filter: false

and also a site setting in system.yaml to default this filter off:

pages:
    allow_taxonomy_filter: false

I am happy to submit a PR for that.

It’s a good idea to have this functionality. I’ll add it. Thanks.

Commited in Develop branch. will be enabled by default (so as not to break existing behavior, but you can either turn it off sitewide in user/config/system.yaml or in your page via:

title: 'All Pages'
content:
    items: 
        @self.children
    order:
        by: date
        dir: desc
    limit: 25
    pagination: true
    url_taxonomy_filters: false

Fantastic, thanks for adding that.