Clicking on “Older Posts” refreshes page instead of going to next page. I think I need to add something in routes.yaml, but not sure what. Right now I have: /art/: art
There are 15 posts on 1 page. I set in package.json under config: “posts_per_page”: 3. Not sure why it’s displaying 15?
I’m lacking a good tutorial on pagination and have just got to this point by some scattered info around the forums. Sorry if I missed the right tutorial.
Thanks, but I still don’t seem to get it right.
I have however gotten a step closer!
Right now the posts don’t show up, but the pagination works. So it goes to /art/page/2, /art/page/3 and so on, also shows how many pages there are.
I’m not sure why I’m not getting the data of the posts, perhaps I’m doing something wrong.
From the link you’ve sent me I learned this:
collections:
/art/:
permalink: /art/{slug}/
template: art
filter: tag:art
data: tag.art
permalink for the pages to work
template to point to art.hbs
filter to filter posts so we don’t load all of the data
data to pass along the data of that tag
So I removed the get helpers as recommended, I took a quick look on how things worked on index.hbs and came up with this code:
Thanks. You’re going to have some trouble here. Collections are exclusive, which means that once one collection has a set of posts, they aren’t available for another collection to have any.
For the moment, take out the tags collection but tell me what you’re using it for. Next, try this:
collections:
/art/:
permalink: /art/{slug}/
template: art
filter: tag:art
data: tag.art
/:
permalink: /{slug}/
template: index
filter: tag:-art
This creates two exclusive collections (which means that art posts will no longer appear on the homepage). If you want those posts there, too, then look at the channel option in the docs.
Thank you for clearing that out and patiently helping me. I don’t want to use a collection. So I finally got it right using a channel.
I’m leaving the yaml here for others that might need it in the future.