Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

Problem with collection filtering on 'type' and 'dateRange'

Started by Genbrua 9 years ago · 2 replies · 824 views
9 years ago

A description of my problem:

I have a blog-like website with in the home folder 'diary'-items as well as a modular page.
/1.diary/
/2.diary/
/etc.diary/
/modular/ (no number, currently unroutable)

The home displays a list of these diary items, including pagination. However, it also adds the modular to the list, which I do not want. How do I 'hide' the modular page from the list?

The settings of the 'list' are as follows:
content:
items: '@self.children'
limit: 8
order:
by: date
dir: desc
pagination: true
url_taxonomy_filters: true
dateRange:
start: 5/5/2014
end: 1/1/2020

According the GRAV's documentation, this should hide the modular page from the list because:
a) @self.children should only fetch non-modular children
b) I set the publication date of the modular page to pre-5/5/2014, meaning the date-range should hide the item.

Despite that, the modular page still shows up in the list.

Next I tried making the page unroutable and adding .routable() to the collection call in the twig file...:

{% set collection = page.collection().routable() %}

... which didn't work either 😦 .

So, my question:
How do I hide the modular page so it is not displayed in the list?

9 years ago

@Genbrua:
content:
items: '@self.children’
limit: 8
order:
by: date
dir: desc
pagination: true
url_taxonomy_filters: true
dateRange:
start: 5/5/2014
end: 1/1/2020

Is that how your markdown file is structured, or are the tabs correct for it? I'm guessing you just couldn't format it correctly on here because I can't figure that out either.

Maybe your twig is being cached. You could go into your config and set it so that it isn't cached and try again. That has caused me problems before in development.

last edited 10/09/17 by Ben Bricker
9 years ago

I can't format YAML properly on this forum =/. Actually, bold text doesn't work either... (?).
The indents in the file itself are correct 🙂.

As for caching, the site is still in development, so caching has already been turned off completely through configuration > system and the various caching options it offers. For the sake of you-never-know, I just manually emptied out the /cache/ dir on the server through SFTP, to make sure everything was gone. That didn't help either 😦.

Suggested topics

Topic Participants Replies Views Activity
Support · by Roger Parkinson, 5 days ago
3 169 11 hours ago
Support · by gravinator, 1 day ago
2 101 17 hours ago
Support · by Marcel, 1 week ago
4 196 5 days ago
Support · by cvgrenoble, 1 week ago
3 177 1 week ago
Support · by Paul Hodges, 1 month ago
19 607 2 weeks ago