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

feat(plugin-blog): multi-authors support + authors.yml global configuration #5396

Merged
merged 55 commits into from
Aug 26, 2021

Conversation

Josh-Cena
Copy link
Collaborator

@Josh-Cena Josh-Cena commented Aug 20, 2021

Motivation

Resolve #5363.

  • Add new authors frontmatter + recommend it over author _* legacy frontmatter (much more flexible)
  • Supports single/multiple authors
  • Allow referencing authors data from a global authors.yml file
  • Allow local (per blog posts) override of authors.yml data
  • The authors.yml file can be localized
  • Refactor templates, docs, and examples with new authors frontmatter
  • Improve init template blog posts

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Unit tests

Dogfood:

Docs:

image

@netlify
Copy link

netlify bot commented Aug 20, 2021

✔️ [V2]
Built without sensitive environment variables

🔨 Explore the source changes: 11be61e

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/611fc8d1f17e8000079a075d

😎 Browse the preview: https://deploy-preview-5396--docusaurus-2.netlify.app

@github-actions
Copy link

github-actions bot commented Aug 20, 2021

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟠 Performance 64
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5396--docusaurus-2.netlify.app/

@github-actions
Copy link

⚡️ Lighthouse report for the changes in this PR:

Category Score
🟢 Performance 98
🟢 Accessibility 98
🟢 Best practices 100
🟢 SEO 100
🟢 PWA 95

Lighthouse ran on https://deploy-preview-5396--docusaurus-2.netlify.app/

@netlify
Copy link

netlify bot commented Aug 20, 2021

✔️ [V2]

🔨 Explore the source changes: 01fa677

🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/612767f9c4b1ed0007e9a094

😎 Browse the preview: https://deploy-preview-5396--docusaurus-2.netlify.app

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.

Looks like a nice start! Thanks

packages/docusaurus-plugin-content-blog/package.json Outdated Show resolved Hide resolved
@@ -100,6 +103,60 @@ function formatBlogPostDate(locale: string, date: Date): string {
}
}

type AuthorMap = Record<string, Author>;

async function readAuthorListFile(
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we have similar code in the docs plugin, we could extract some utility function that could read from js/yaml in a generic way?

Like readConfigFile("blog/authors",schema)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In fact the YAML parser should be able to parse JSON because YAML is a superset of JSON. Should I make that refactor here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes discovered that recently 🤪

I'll do it and try to merge this PR asap.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe not entirely true? https://stackoverflow.com/questions/21584985/what-valid-json-files-are-not-valid-yaml-1-1-files

I ended up not doing it because at least it works right now

packages/docusaurus-plugin-content-blog/src/blogUtils.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-blog/src/blogUtils.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-blog/src/blogUtils.ts Outdated Show resolved Hide resolved
packages/docusaurus-plugin-content-blog/src/blogUtils.ts Outdated Show resolved Hide resolved
@Josh-Cena Josh-Cena marked this pull request as draft August 21, 2021 02:16
@Josh-Cena
Copy link
Collaborator Author

It would be cool if we can either deprecate Bootstrap theme or actually maintain it 😅 Really awkward to make type check pass while at runtime it would actually break

@Josh-Cena Josh-Cena marked this pull request as ready for review August 23, 2021 03:38
@Josh-Cena Josh-Cena force-pushed the blog-author-profile branch 2 times, most recently from 5c2bd41 to 95a0dde Compare August 23, 2021 07:28
@Josh-Cena

This comment has been minimized.

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
@slorber slorber changed the title feat(plugin-blog): global blog author profile list feat(plugin-blog): Add multi-authors support + authors.yml global configuration Aug 25, 2021
@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Aug 25, 2021
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
@Josh-Cena Josh-Cena changed the title feat(plugin-blog): Add multi-authors support + authors.yml global configuration feat(plugin-blog): multi-authors support + authors.yml global configuration Aug 26, 2021
@slorber slorber merged commit 493225a into facebook:main Aug 26, 2021
@Josh-Cena Josh-Cena deleted the blog-author-profile branch August 26, 2021 10:25
charleskorn added a commit to batect/batect.dev that referenced this pull request Aug 27, 2021
@yzeng25
Copy link

yzeng25 commented Dec 8, 2021

Thank you for implementing this feature! It is really helpful for bilingual blog maintenance in https://apisix.apache.org/blog, where technical writers and translators need to get involved in the documents, and they deserve the credit.

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.

Blog: author profile list file
5 participants