docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

proposed feature: blog pagination active

Open johnnyreilly opened this issue 1 year ago • 5 comments

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:

  1. I go to the blog and look at the latest entry (often what I'm interested in) or
  2. 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
  3. I click on "archive" and hit CMD+F to find a post I'm interested in or
  4. 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:

screenshot of google search console

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

image

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

johnnyreilly avatar Nov 12 '22 06:11 johnnyreilly

[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...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Nov 12 '22 06:11 netlify[bot]

⚡️ 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

github-actions[bot] avatar Nov 12 '22 06:11 github-actions[bot]

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?

Josh-Cena avatar Nov 17 '22 14:11 Josh-Cena

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

slorber avatar Nov 17 '22 14:11 slorber

Thanks for the comments - have added some thoughts to the linked discussion.

johnnyreilly avatar Nov 17 '22 15:11 johnnyreilly