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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Page collections without using taxonomy?

Started by Muut Archive 12 years ago · 2 replies · 338 views
12 years ago

Hi,

Is it possible to get page collections where there is is no taxonomy data defined? The following is an example used in the learn skeleton:

TWIG
{% set progress = page.collection({'items':{'@taxonomy.category': 'docs'},'order': {'by': 'default', 'dir': 'asc'}}) %}

Is it possible to get a collection based on other criteria, e.g. by template used or by parent page / slug etc.

I've tried variations of the following, which don't work:

TWIG
{% set progress = page.collection({'items':{'template': 'blog'},'order': {'by': 'default', 'dir': 'asc'}}) %}

Any help would be appreciated.

Cheers!

12 years ago

Currently collections only support 3 things:

  • Modular Children
  • Regular Children
  • Children based on Taxonomy

Having arbitrary collection support will have big performance implications, so we have ensured that our supported types are very efficient. The best bet is to use a custom taxonomy type if you want to group arbitrary pages together.

http://learn.getgrav.org/content/headers

You can read about the available options here. If there is a good use case for some other kind of collection type, and we can make it performant enough, we are certainly willing to add that functionality. However, my gut feeling is that taxonomies assigned to pages are the best solution due to the way those are cached.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1279 9 years ago
Archive · by Muut Archive, 9 years ago
2 886 9 years ago
Archive · by Muut Archive, 9 years ago
2 4015 9 years ago
Archive · by Muut Archive, 9 years ago
1 2891 9 years ago
Archive · by Muut Archive, 9 years ago
3 1075 9 years ago