Hello there, I’ve been using Grav CMS for quite a while and am familiar with creating blueprints and using new fields in my twig templates it’s a lot of fun so far!
what I am struggling with now is a field with the type “pages”, where users can set a page as the “top article”. so far, it has always been the newest article:
{% set newest_article = page.collection({
'items': '@root.descendants',
'filter': {
'type': 'article',
},
'order': {
'by': 'date',
'dir': 'desc',
},
'limit': 1
}) %}
now I’d like to do something like:
{% if page.header.topArticle %}
{% set newest_article = page.find(page.header.topArticle) %}
{% else %}
{% set newest_article = page.collection({
But I cannot get it to work and been searching for hours… How do I “load” a page from a type:pages field?
Thanks!