Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category won't fully populate for blog posts #42

Open
teonbrooks opened this issue Mar 13, 2024 · 1 comment
Open

Category won't fully populate for blog posts #42

teonbrooks opened this issue Mar 13, 2024 · 1 comment

Comments

@teonbrooks
Copy link

I noticed that under the category section of my blog that it is not fully populated. I believe this is caused by the line below

const res = await fetch(`${url.origin}/api/posts.json`)

when the posts.json is being fetched, it's being limited with the parameter postsPerPages, which only retrieves the first page of blog posts. However, to properly populate the category page, it needs to retrieve the entirety of posts.

It doesn't currently have a way to accept an argument

@josh-collinsworth
Copy link
Owner

@teonbrooks Sorry, it looks like I messed up category pagination. I'll leave this open until I fix that.

Meanwhile, if you want all posts of a given category to show up on one page, you can just delete the limit: -1 option from the options object in src/routes/blog/category/[category]/+page.server.js. That'll cause the API call to return all posts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants