-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Conversation
✔️ [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 |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-6239--docusaurus-2.netlify.app/ |
Size Change: 0 B Total Size: 670 kB ℹ️ View Unchanged
|
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)} |
There was a problem hiding this comment.
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?)
ok, that seems good enough 👍 thanks |
are the docs updated with how to use this feature? Can it be used to set metadata for blog folder index page? |
@pranay01 this feature is related to docs category, it is not related in any way to the blog |
Doc was missing so added in #6708 |
Motivation
Close #6238.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Dogfooding
TODO
require
call:require('/img/docusaurus.png')
doesn't seem to work despite we haveresolve.roots
?