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

Posts
|-- 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
process:
   twig: true
   markdown: false
twig_first: true
never_cache_twig: true
content:
   items: '@self.descendants'
   filter:
     non-visible: true
     type: item
   order:
      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.

@cfas,

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/blog.md

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

Question:

  • 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?