-
Notifications
You must be signed in to change notification settings - Fork 373
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
fix(plugin-runtime): Document.tsx should work normal with title tag render #4961
Conversation
🦋 Changeset detectedLatest commit: 909109e The changes in this PR will be included in the next version bump. This PR includes changesets to release 269 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This case fix and work fine under pia side, so i also send a pr for modern.js. |
@clChenLiang please review this PR ❤️ |
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.
Had test in local dev
… html.title or html.titleByEntries
6711859
to
909109e
Compare
done~ |
@chenjiahan everything is ok 😬 |
@clChenLiang cc |
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.
LGTM
fix(plugin-runtime): Document.tsx should work normal when user config html.title or html.titleByEntries
Summary
🤖[deprecated] Generated by Copilot at 72e99f7
This pull request improves the document title handling in the
@modern-js/runtime
package. It adds a newTitle
component that uses aDOCUMENT_TITLE_PLACEHOLDER
constant to render the title element. It also allows the user to configure the title via thehtml
options or use a custom title element from the document.Details
🤖[deprecated] Generated by Copilot at 72e99f7
@modern-js/runtime
package (link)DOCUMENT_TITLE_PLACEHOLDER
to represent the template expression for the document title (link)DOCUMENT_TITLE_PLACEHOLDER
constant to thedocumentPlugin
file and theTitle
component file (link, link)titles
in thedocumentPlugin
function to concatenate the user-configured title and the custom title element from the document (link)DOCUMENT_TITLE_PLACEHOLDER
in the final HTML with thetitles
variable in thedocumentPlugin
function (link)hasSetTitle
to theDocumentStructureContextProps
type and theDocumentStructureContext
provider to indicate whether the document has a custom title element or not (link, link)hasSetTitle
property to theDocumentStructureContext
provider in theHtml
component function, based on the result of thefindTargetElement
helper function (link, link)hasSetTitle
property from theDocumentStructureContext
in theHead
component function (link)Title
component in theHead
component function, based on thehasSetTitle
property (link)DefaultHead
component function (link)Title
component, which renders a title element with theDOCUMENT_TITLE_PLACEHOLDER
as its content (link)document/index.test.tsx
file to include theTitle
component with theDOCUMENT_TITLE_PLACEHOLDER
in the expected output (link)document/index.test.tsx
file to check that theTitle
component renders theDOCUMENT_TITLE_PLACEHOLDER
successfully when the document has a custom title element (link)Related Issue
Checklist
pnpm run change
.