Collection Being Looped Through Twice

Happy New Years everyone.

So, I’m using Grav as a hobby and I am running into an issue - after updating from the last version my collection on a page looks like it is being run through twice in my For Each.

The folder structure is

|-- Mobile
|   |-- Mobile Post 1
|   |-- Mobile Post 2
|-- Pc
    |-- Pc Post 1
    |-- PC Post 2

On the posts file I have the header defined as :

title: Posts
   twig: true
   markdown: false
twig_first: true
never_cache_twig: true
   items: '@self.descendants'
     non-visible: true
     type: item
      by: date
      dir: desct
   limit: 12
   pagination: 'true'

I’ve tried changing between .descendants and .children

and then the page code is:

{% for p in page.collection %}
  <h2>{{ p.title|e }}</h2>
  {{ p.summary|raw }}
{% endfor %}

Thank you for any help!

Found the cause but not exactly - I was trying the bootstrap4 theme and the current version of it was causing this. The issue is not present in any other theme and the collections display properly.


I cannot reproduce the issue. I’ve:

  • installed theme Bootstrap4,
  • created a folder structure similar to yours and
  • added the frontmatter + code to /pages/02.posts/

The Posts page both shows a correct blog list of all descendants and show a correct list of children inside the pages content.


  • Is there a specific reason why you create a list of posts inside a page’s content, instead of letting a template create the list?