I don’t think I described this very well in the title, so I’ll try and do it better here. I have 2 collections, _months
and _days
. I have a layout, day
, that makes the day files look the way I like them, and they are generated as such. I would like my other layout, month
, to have each day in it, but formatted with the day
layout. I have the following, but it doesn’t apply the layout to the pages. Is there a way to do this without sticking the contents of the day layout inside the loop?
{% for day in site.days %}
{% if day.path contains "January" %}
{{day.content}}
{% endif %}
{% endfor %}
1 Like
Probably includes is what you are looking for.
.
What it wrong with a for loop?
I guess you can make a month.html layout and then that uses the page name to figure out what month it is and then get the appropriate days data and put it on the page.
assign month = page.name
assign days = site.days | where: 'month', month
Then each month needs minimal content as it’s for loop will be in a layout.
You can also ditch using a separate days collection and this for loop matching across different collection
And rather do a more intuitive layout of make collections with month and day data
E.g
_months/
01-jan/
01.md
05.md
02-feb/
02.md
24.md