cotko
November 10, 2018, 11:52am
1
Hi,
is it possible to add a custom route like this:
/year/2018
which would filter the posts by year and have optional /page/2 etc available?
I tried with
/year/:
permalink: /year/{year}
but this acts as an entry, not a collection (entry route is used).
This should work:
routes:
/year/2018/:
controller: channel
filter: published_at:>'2018'+published_at:<'2019+page:false'
But then you need to route for each year manually. Another more advanced solution is to route “/year/:year” and in a custom template read the “:year” slug. Then use it to get posts by year using handlebar helpers.
cotko
November 10, 2018, 9:13pm
3
Thanks, how exactly should yaml entry for “/year/:year” look like, I can’t get it working
system
Closed
November 24, 2018, 9:13pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.