Repository navigation
feat(v2): include frontmatter in loadedContent doc metadatas - #4495
Conversation
|
[V1] Deploy preview success Built with commit 8b4cbdc |
|
Deploy preview for docusaurus-2 ready! Built with commit 8b4cbdc |
|
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-4495--docusaurus-2.netlify.app/ |
647f8a3 to
3bc5541
Compare
|
going to close this for now as I don't think it's what we should do, cf #4492 |
|
oh actually this makes sense, it's just a "wording" issue. We want frontmatter in |
slorber
left a comment
There was a problem hiding this comment.
I think we can add this, just need to remove the option and remove usage of global data.
It won't solve your sidebar problem directly but at least make the frontmatter available in loadedContent()
| ) | ||
| : undefined, | ||
| sidebar_label: sidebarLabel, | ||
| frontMatter: options.includeFrontMatterInGlobals ? frontMatter : undefined, |
There was a problem hiding this comment.
I think we want frontMatter here in all cases
| id: doc.unversionedId, | ||
| path: doc.permalink, | ||
| sidebar: doc.sidebar, | ||
| ...(doc.frontMatter && {frontMatter: doc.frontMatter}), |
There was a problem hiding this comment.
I think we don't want frontmatter here, as it increases the size of all the site's pages
| versions: {}, | ||
| editCurrentVersion: false, | ||
| editLocalizedFiles: false, | ||
| includeFrontMatterInGlobals: false, |
| editUrl: Joi.alternatives().try(URISchema, Joi.function()), | ||
| editCurrentVersion: Joi.boolean().default(DEFAULT_OPTIONS.editCurrentVersion), | ||
| editLocalizedFiles: Joi.boolean().default(DEFAULT_OPTIONS.editLocalizedFiles), | ||
| includeFrontMatterInGlobals: Joi.boolean().default( |
| id: string; | ||
| path: string; | ||
| sidebar: string | undefined; | ||
| frontMatter?: FrontMatter; |
| // eslint-disable-next-line camelcase | ||
| sidebar_label?: string; | ||
| editUrl?: string | null; | ||
| frontMatter?: FrontMatter; |
* feat: include frontmatter in globals * feat: include frontmatter in globals (options schema test) * feat(v2): document frontmatter in document metadata * feat(v2): frontmatter in metadata, tests updated * Update packages/docusaurus-plugin-content-docs/src/types.ts * Update packages/docusaurus-plugin-content-docs/src/types.ts Co-authored-by: Sébastien Lorber <[email protected]>
Motivation
Fixes #4492
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
Added a new test using the new config option. All previous tests still pass.
Related PRs
None right now, will add if this PR is accepted.