Weird behaviour on modular Recent Posts template (Editorial Theme)

Recently a user alerted me to a bug in the Editorial theme, really strange. When a blog page with a future post date is published, this page is not displayed on the blog until the set post date arrives. However, on the Recent Posts modular page, the same is not the case, showing the future date page.

I’ve reviewed the recent posts template code and found the following:

If I change the current line

{% for p in blog.children.order('date', 'desc').slice(0,limit) %}

it is based on the blog page previously defined in

{% set blog = page.find(header_var('blog_url')|defined(theme_var('blog-page'))) %}

{% set limit = page.header.limit|default(3) %}

by the following:

{% for p in blog.collection.slice(0,limit) %}

then the page behaves as normal, not showing any future blog posts.

Why is this happening? I have some confusion about the difference between using a collection and children pages

Hi, @pmoreno, you can use blog.children.published.order('date', 'desc').slice(0,limit) in the first case. Read this issue on github, you should probably get some clarification.

1 Like

Hi @b.da

Thanks for the information. I will try your suggestion, although I have finally used the solution above to solve the problem (using the blog.collection)