Hi. I’m obviously missing / misunderstanding something, so if anyone would care to help point me in the right direction I’d appreciate it.
I have a file user/pages/news/newsblog.md
The content is shown below. I’m trying to get return a collection of all of the children (news posts) but I want to traverse them in descending date order, that is the newest ones first.
You’re on the right track, you just need to have a twig template that takes the resulting collection you have created with these settings and iterate over it.
The best way to do this is to check out a skeleton. I suggest the blog skeleton package. This page defines the blog listing:
And then this is rendered by the blog.html.twig template in the Antimatter theme.
This line creates a variable called collection from page.collection (just a shortcut really):
Then this is looped over and a partial used to render:
I checked your blog.md example and I tried the same thing. So I must be close. The only problem is that I get this error message. I’m wondering if this is perhaps a bug?
The thing you need to be careful about is that the YAML is very sensitive and should be formatted with spaces only. Tabs may not work. In my case I took out the tabs and replaced them with spaces and we were all good to go from that point.