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.

Content & Markdown

Filtering Items in Blog List

Solved by Fux Ing View solution

Started by Fux Ing 5 years ago · 3 replies · 813 views
5 years ago

Hallo!
I have several pages, which are blog lists, containing several blog items:
image|683x302

Now I want to add a pages containing all the Items, but not the Lists.
I tried to add filters to the page, but honestly I don't have any idea how this should work.
My try:

YAML
content:
    items:
        - '@root.descendants'
        filter:
            type: 'blog-item'

Is there anyway to do so?

Thanks in advance
Jürgen

5 years ago

Hallo again!

Is there really no one having an idea?

THANKS

5 years ago

@fuxing, Not knowing:

  • where blog items are located below '/pages' folder
  • what categories/tags have been used

I can only suggest to combine the collection definitions of the blog pages into one singe blog page. For example, when using the 'Blog Site' skeleton and the following content definition, the blog page will contain all blog items with tag 'mushroom' or 'city' found below the '/pages' folder:

YAML
---
content:
  items:
    - '@taxonomy':
        tag: [mushroom]
    - '@taxonomy':
        tag: [city]
---

Collections are an important part of Grav, you might want to take a closer look at the Page Collections documentation

👍 1
5 years ago Solution

Thanks for your answer and the link to the "Page Collections" helped!
Because i don't want to use tags or categories, I need to use the type filter.
But my mistake was the "-" because I have to use "blog_item" instead.

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 8 months ago
6 97 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 185 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 148 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 61 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 255 1 year ago