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

proposed feature: blog pagination active #8326

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

johnnyreilly
Copy link
Contributor

@johnnyreilly johnnyreilly commented Nov 12, 2022

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • 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

#8311

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 12, 2022
@netlify
Copy link

netlify bot commented Nov 12, 2022

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit e893df6
🔍 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.

@github-actions
Copy link

github-actions bot commented Nov 12, 2022

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

@@ -214,6 +257,7 @@ describe('linkify', () => {
frontMatter: {},
authors: [],
formattedDate: '',
unlisted: false,
Copy link
Contributor Author

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!

Copy link
Collaborator

@slorber slorber left a 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;
Copy link
Collaborator

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

@Josh-Cena
Copy link
Collaborator

Josh-Cena commented Nov 17, 2022

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?

@slorber
Copy link
Collaborator

slorber commented Nov 17, 2022

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

@johnnyreilly
Copy link
Contributor Author

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

@slorber slorber marked this pull request as draft November 17, 2022 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants