Comments (7)
Looks like the limit is set to 2 here:
from sveltekit-blog-template.
Hm, strange. I've been holding off updating this template until 1.0 comes out as it seems to be around the corner. This didn't happen prior to updating kit? If you can create a reproduction so I can take a look that would be very helpful.
The recentPosts snippet is only used for the index page and shouldn't affect /posts (maybe there's some weird caching going on?)
from sveltekit-blog-template.
@mattjennings The issue only arise after you update kit version to 1.0.0-next.357 (I did not tested with lower versions)
Downgrading the kit to current locked version removes the issue immediately with no other change in the codebase (except some tiny stuffs like changing %svelte.head%
to %sveltekit.head%
etc.
Also notice you will not face the issue when you run it in dev mode npm run dev
It only appears on production build npm run build && npm run preview
The issue has no relevance with the limit set in recentPosts.
I tried to open the endpoint /posts.json
without any query params and it still returns only 2 posts always even when you paginate it will always return same latest 2 post for every page and it also allows you to paginate as much as you want, you can go up on page count without any limit, even if you have just 20 posts, you can go to page 100 and still see same 2 post always.
from sveltekit-blog-template.
@ak4zh I've updated this template the latest version of kit and made a few changes. Please look over these changes or make a new copy of this repo and move your content over (probably the easiest way).
Here's a summary of the changes:
- updated kit to next.357
- removed
/posts.json.js
in favour of page endpoints for the routes that used it. I'm not entirely sure what was causing it to only show 2 posts, but I much prefer the page endpoints approach anyway and it solved the issue. - changed adapter from static to auto as vercel was having issues with routing on the static adapter
- updated svelte.config.js, jsconfig.json
from sveltekit-blog-template.
@mattjennings Thanks for the update.
I am planning to make a pull request to probably add a search feature and post category.
I am also wondering if there is a specific reason you chose to run pagination via a static url instead of query params?
from sveltekit-blog-template.
I wanted to keep it working with the static adapter. Using query params would have meant SSR or client-side data fetching, and as a result breaking the static export. Now that it's using auto maybe I'll change that, I dunno. I don't want SSR to be a requirement (and therefore requiring vercel/netlify/a node server to deploy).
re: search & post category functionality, I'm probably just going to leave this template as it is features-wise. But I appreciate the idea!
from sveltekit-blog-template.
The static pagination makes sense now.
Thank you for the answers.
from sveltekit-blog-template.
Related Issues (20)
- Cannot access query on a page with prerendering enabled HOT 2
- Unexpected token < in JSON at position 0 HOT 1
- Table of content HOT 1
- Switching post does not update the title, data and reading time HOT 1
- Better line breaks HOT 1
- Tags support HOT 2
- Rendering preview.html HOT 2
- Using variables in headings HOT 1
- Table of contents dont refresh after clicking internal link HOT 1
- Typescript rewrite HOT 2
- Using relative url (images) in YAML
- Build issue when deplyoing to Cloudflare pages HOT 1
- adding page transitions HOT 1
- An error occurred while processing non-English headings in the md document.
- need help debug website sveltekit
- Dynamically loading posts (infinite loading)
- Issue with post dates (timezone and locale date format) HOT 5
- Can you clarify how you want this code to be used by providing a license please ? HOT 2
- I am facing the same dynamic loader issue you had please help ! HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sveltekit-blog-template.