-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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(core): new postBuild({routesBuildMetadata})
API, deprecate head
attribute + v4 future flag
#10850
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ [V2]
To edit notification comments on pull requests, go to your Netlify site configuration. |
Size Change: +3.21 kB (+0.03%) Total Size: 11.8 MB
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
Size Change: +3.26 kB (+0.03%) Total Size: 12.3 MB
ℹ️ View Unchanged
|
…api' into slorber/future-v4-head-metadata-api # Conflicts: # packages/docusaurus/src/client/serverEntry.tsx
slorber
changed the title
feat(core): new
feat(core): new Jan 17, 2025
postBuild({routesBuildMetadata})
APIpostBuild({routesBuildMetadata})
API, deprecate postBuild({head})
slorber
changed the title
feat(core): new
feat(core): new Jan 17, 2025
postBuild({routesBuildMetadata})
API, deprecate postBuild({head})
postBuild({routesBuildMetadata})
API, deprecate head
attribute + v4 future flag
This was referenced Jan 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
Before:
postBuild({head})
Deprecated, legacy and prevents further optimization
The future flag entirely disable this API:
siteConfig.future.v4.removeLegacyPostBuildHeadAttribute: true
After:
postBuild({routesBuildMetadata})
The injected
routesBuildMetadata
data structure looks like this:Motivation
This PR introduces a new public plugin API:
postBuild({routesBuildMetadata})
For now it's mostly useful internally for our own sitemap plugin to know if a route has a
noindex
meta tagBut we'll eventually extend it to other use cases in the future if users post feature requests.
This aims to replace the legacy
postBuild({head})
API that exposed as-is the React-Helmet data structure as a public API to plugin authors.We never documented this officially and only used it inside our sitemap plugin, but to avoid a possible breaking change, I'm not removing it immediately and introduced a v4 future flag:
siteConfig.future.v4.removeLegacyPostBuildHeadAttribute: true
We'll recommend that users turn all v4 future flags on.
Another future flag to optimize SSG time is coming in another PR (#10826) and requires
siteConfig.future.v4.removeLegacyPostBuildHeadAttribute
to be turned on to work.The goal is to unlock the ability to SSG in worker threads in #10826, to improve SSG performance significantly, that can only be done if we do an opt-in breaking change by removing the
head
attribute entirely.Test Plan
CI + preview
https://deploy-preview-10850--docusaurus-2.netlify.app/
No significant sitemap.xml change before and after (apart lastmod date on docs)