I’m just getting started with Grav, and starting digging into customizing the default theme. I wanted to duplicate, then tweak, the blog template. So, I replicated the blog.html.twig file (and renamed it to articles.html.twig). I made no other code changes to the file. However, when I selected that template for the parent page from the admin panel, the page no longer worked properly. The header showed up, but the items disappeared. What do I need to change in the duplicated file so that it works as expected?
Here is that page on my development site: http://christinar2.sg-host.com/grav/articles
@fidlet, Did you define the collection of blog pages in the frontmatter of articles.md
?
For example:
---
title: Articles
content:
items: '@self.children'
limit: '6'
order:
by: date
dir: desc
pagination: '1'
url_taxonomy_filters: '1'
---
You can read more about collections in the docs: Page Collections
This is what I have in articles.md (it was generated by the admin panel):
---
title: Articles
child_type: article
hero_classes: ''
hero_image: ''
content:
items: '- ''@self.children'''
limit: '5'
order:
by: date
dir: desc
pagination: '1'
url_taxonomy_filters: '1'
---
@fidlet,
The following doesn’t look right, and produces a page without any blog items:
items: '- ''@self.children'''
I would expect an error of some sort, but the page is working fine except for the lack of blog items.
Try:
items: '@self.children'
Perfect! That fixed it – thanks!