docusaurus
docusaurus copied to clipboard
proposed feature: blog pagination active
Pre-flight checklist
- [x] I have read the Contributing Guidelines on pull requests.
- [x] If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
- [ ] If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.
Motivation
This was discussed with @slorber here. - it hasn't been agreed that this functionality is desired, but I thought I'd put something together to illustrate what I had in mind.
This PR adds a new configuration item called blogPaginationActive
which defaults to true
. But it can be set to false
which results in the /page/2
etc blog post pages not being generated and the navigation buttons not being rendered.
I run my blog as publishing one blog per page: https://blog.johnnyreilly.com/
I navigate my own blog in the following ways:
- I go to the blog and look at the latest entry (often what I'm interested in) or
- I click on the search box and type words in to get the algolia search results that leads me to the post I'm after or
- I click on "archive" and hit CMD+F to find a post I'm interested in or
- I google my name and the topic I'm after and pick a blog post out of the search results
The thing I never do is use the pagination mechanism. I often can't remember when I wrote something, and I write a lot; I have 200+ posts. I'd spend ages clicking "older entries" and scrolling hoping to find what I was after.
For blogs with a lot of entries, the pagination mechanism isn't that useful. Many pages are generated that Google doesn't find very helpful from an SEO perspective as it considers them duplicates. Also, as new posts are published, the meaning of /page/2
etc changes:
With pagination off:
- I would have less pages on the blog, and since we'd be removing duplicate content /
/page/
style pages that's useful. Website size would decrease, data costs would decrease, search engines would have less to crawl. - I'd get rid of functionality I don't use (or consider very useful)
- possibly build times might be faster, as less pages are being generated?
Test Plan
Note how there is no "Older Entries" button. See also the tests.
Test links
Deploy preview: https://deploy-preview-8326--docusaurus-2.netlify.app/
Related issues/PRs
https://github.com/facebook/docusaurus/discussions/8311
[V2]
Built without sensitive environment variables
Name | Link |
---|---|
Latest commit | e893df611651d0c1e4c499982ebba4a31cebdbd1 |
Latest deploy log | https://app.netlify.com/sites/docusaurus-2/deploys/636f5be7025b2a0008f26402 |
Deploy Preview | https://deploy-preview-8326--docusaurus-2.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
⚡️ Lighthouse report for the deploy preview of this PR
URL | Performance | Accessibility | Best Practices | SEO | PWA | Report |
---|---|---|---|---|---|---|
/ | 🟢 93 | 🟢 97 | 🟢 100 | 🟢 100 | 🟢 90 | Report |
/docs/installation | 🟠 78 | 🟢 100 | 🟢 100 | 🟢 100 | 🟢 90 | Report |
I really like the API design of using postsPerPage: 0
to disable posts pages (similar to how that disables the sidebar). Have there been discussions about this?
I really like the API design of using
postsPerPage: 0
to disable posts pages (similar to how that disables the sidebar). Have there been discussions about this?
👍 looks fine to me too
postsPerPage
currently requires min(1) but we can change that
Thanks for the comments - have added some thoughts to the linked discussion.