Custom collection route to filter posts by year



is it possible to add a custom route like this:


which would filter the posts by year and have optional /page/2 etc available?

I tried with
permalink: /year/{year}

but this acts as an entry, not a collection (entry route is used).


This should work:


    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.


Thanks, how exactly should yaml entry for “/year/:year” look like, I can’t get it working :confused:


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.