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(content-docs): allow SEO metadata for category index pages #6239

Merged
merged 2 commits into from
Jan 6, 2022

Conversation

Josh-Cena
Copy link
Collaborator

Motivation

Close #6238.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Dogfooding

TODO

  • Can't figure out how to turn the image into a require call: require('/img/docusaurus.png') doesn't seem to work despite we have resolve.roots?
  • Documentation

@Josh-Cena Josh-Cena added the pr: new feature This PR adds a new API or behavior. label Jan 1, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Jan 1, 2022
@netlify
Copy link

netlify bot commented Jan 1, 2022

✔️ [V2]

🔨 Explore the source changes: 5e7b53d

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

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

@github-actions
Copy link

github-actions bot commented Jan 1, 2022

⚡️ Lighthouse report for the changes in this PR:

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

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

@github-actions
Copy link

github-actions bot commented Jan 1, 2022

Size Change: 0 B

Total Size: 670 kB

ℹ️ View Unchanged
Filename Size
website/.docusaurus/globalData.json 40.1 kB
website/build/assets/css/styles.********.css 102 kB
website/build/assets/js/main.********.js 498 kB
website/build/index.html 29.6 kB

compressed-size-action

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.

Not sure it's the approach we should take to solve this problem.

See my comment #6238 (comment)

@@ -28,6 +28,8 @@ function getCategoryGeneratedIndexMetadata({
return {
title: category.link.title ?? category.label,
description: category.link.description,
image: category.link.image,
keywords: category.link.keywords,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not fan of handling only these 2 metas (particularly as keywords is not even very useful) and not allowing the others.

If we do this, we'd rather have a more flexible API allowing any kind of meta?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These are the two that the SEO component actually accepts

@@ -26,6 +27,9 @@ export default function DocCategoryGeneratedIndexPage({
<Seo
title={categoryGeneratedIndex.title}
description={categoryGeneratedIndex.description}
keywords={categoryGeneratedIndex.keywords}
// TODO `require` this?
image={useBaseUrl(categoryGeneratedIndex.image)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

🤷‍♂️ not sure how to make this possible in Webpack (!= usecase than mdx exporting frontMatterAssets), and users would need to put all images in static (not sure where else they could live?)

@slorber
Copy link
Collaborator

slorber commented Jan 6, 2022

ok, that seems good enough 👍 thanks

@slorber slorber merged commit 3cb9912 into main Jan 6, 2022
@slorber slorber deleted the jc/category-index-metadata branch January 6, 2022 10:31
@pranay01
Copy link

are the docs updated with how to use this feature? Can it be used to set metadata for blog folder index page?

@slorber
Copy link
Collaborator

slorber commented Feb 17, 2022

@pranay01 this feature is related to docs category, it is not related in any way to the blog

@slorber
Copy link
Collaborator

slorber commented Feb 17, 2022

Doc was missing so added in #6708

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.

SEO Metadata for generated-index pages
4 participants