How do I display several posts in related "weeks"
Hello everyone,,
I would like to structure my blog so that I can assign posts I have created with Trix and Shrine to weeks.
I want to have 12 teaserboxes on my index page which can then be clicked and if I click on week 1, for example, only the posts that are assigned to week 1 are displayed.
What's the smartest way to go? Should I make an extra week model? And can I somehow make a sort of assignment while creating the post that this post is a post for week 1? Are there any instructions or tips on how to do this? I'm totally overwhelmed with it right now. Currently all my posts are listed under /posts.
Depends on how many weeks you want to do, but I would add an extra week model as this allows you to grow the number of weeks without having to add more columns to your posts.
Then you can just pass a param to the posts index to specify the week that you want to display.
Alternative: You can add a 'week' column that is an integer and just put the week number in there, eg 1,2,3,4,5,6.