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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): add blog post estimated reading time #2531

Merged
merged 6 commits into from
Apr 5, 2020

Conversation

JoseRenan
Copy link
Contributor

@JoseRenan JoseRenan commented Apr 4, 2020

Motivation

Resolve #2467

As described in #2467, it's very common to see on blogs the estimated reading time of posts, so the purpose of this change is to add the estimated reading time of blog posts in docusaurus.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Go to the blog page and the estimated reading time will be there:
image

You can also set the prop showReadingTime to false on the blog section of docusaurus.config.js and the reading time will not be shown anymore

Observations

  • In order to calculate it, I used a library called reading-time which is used by a similar plugin on gatsby to calculate the estimated reading time, but I think it can be calculated without a library 馃

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 4, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Apr 4, 2020

Deploy preview for docusaurus-2 ready!

Built with commit 27a5189

https://deploy-preview-2531--docusaurus-2.netlify.com

Copy link
Contributor

@fanny fanny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JoseRenan amazing work! 鉂わ笍 Just a detail, could you update the existing test with your new field?

@yangshun yangshun changed the title Add blog post estimated reading time feat(v2): add blog post estimated reading time Apr 5, 2020
@yangshun yangshun added the pr: new feature This PR adds a new API or behavior. label Apr 5, 2020
Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Could you also document the new option in website/docs/using-plugins.md for the blog plugin?

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@yangshun yangshun merged commit 95fdfe7 into facebook:master Apr 5, 2020
@yangshun yangshun added this to the v2.0.0-alpha.51 milestone Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(v2): add time prediction in the description of a post blog
6 participants