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
proposed feature: blog pagination active #8326
base: main
Are you sure you want to change the base?
proposed feature: blog pagination active #8326
Conversation
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
@@ -214,6 +257,7 @@ describe('linkify', () => { | |||
frontMatter: {}, | |||
authors: [], | |||
formattedDate: '', | |||
unlisted: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added as I noticed a type error when I was in the file, so I thought I'd fix it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments here: #8311 (reply in thread)
const numberOfPages = Math.ceil(totalCount / postsPerPage); | ||
const numberOfPages = blogPaginationActive | ||
? Math.ceil(totalCount / postsPerPage) | ||
: 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's where we disagree, cf my comment here: #8311 (reply in thread)
For me this option should plainly disable the whole blog pagination, and ensure that the theme.BlogListPage
component never gets renderer.
Also postsPerPage
is not an API that feels appropriate to control the number of posts displayed on your landing page
I really like the API design of using |
👍 looks fine to me too
|
Thanks for the comments - have added some thoughts to the linked discussion. |
Pre-flight checklist
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 totrue
. But it can be set tofalse
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:
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:
/page/
style pages that's useful. Website size would decrease, data costs would decrease, search engines would have less to crawl.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
#8311