I am trying to group entries based on week and then paginate them the same way. I'm not quite sure how to go about setting each page to be a separate week/group though. Thoughts?

1 Answer 1


The paginate tag isn't really designed to be used in this way. Instead you might want to look into creating a custom route using 'year','month','day' segment tags. These segment tags will be available as variables in your template, which you can use to grab the corresponding entries for that week (by calculating the start and end date of the week and grabbing entries with a postDate between these dates).

You can then create 'next' and 'previous' links to link to a day at the start of the previous/next week by adding or subtracting 7 days.

This answer shows an example using this technique for paginating by day. That should get you most of the way there. Leave a comment if you still need help, and I can try and mock something up.

Update Another option is to create a custom route using 'subpatterns' defined in your config file for 'events/year/week':

'events/(?P<year>\d{4})/(?P<week>\d{2})' => 'events/_weekindex',

This will make the variables {{year}} and {{week}} available to your template, which you can use to grab the entries.

You can convert weekNo to date using {{ date.setISODate(year, weekNo) }} and date to week using{{ now|date('Y/W') }}`.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.