Fix: ember-page-title errors when head format template contains <title>#3933
Fix: ember-page-title errors when head format template contains <title>#3933
ember-page-title errors when head format template contains <title>#3933Conversation
Preview deployments |
0c021be to
429efc7
Compare
|
@codex please review |
|
Is there still a conflict between ember-page-title updating the title and dynamically updated "head" formats updating the page title? If so, which one wins? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0ca659d5a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (headHTML != null) { | ||
| headFragments.push(headHTML); | ||
| headFragments.push(this.ensureSingleTitle(headHTML)); | ||
| } | ||
|
|
||
| if (scopedCSS != null) { |
There was a problem hiding this comment.
Preserve default title when only scoped CSS is injected
Because the default <title> was moved into the data-boxel-head-* region, calling injectHeadHTML will remove it. In this block you only add a title when headHTML != null, so when a card has no head template but does have scoped CSS, the injected head becomes just the <style> block and the page ends up with zero <title>. This is likely for cards that define scoped CSS but no head format. Consider adding the default title whenever you inject head content without a title, or explicitly include it when headHTML is null but scopedCSS is present.
Useful? React with 👍 / 👎.
The title that is set by |
|
@lukemelia I've added logic so the ember page title no longer overwrites the head format template. |
Previously, the default
<title>Boxel</title>lived outside the injectable head zone inindex.html, while the realm-server and host mode inject head HTML betweendata-boxel-head-startanddata-boxel-head-end. Enabling the title in the head template would have added a second title, so it stayed commented out. This PR moves the default title into that injectable zone and re-enables it in the head template so injected head replaces the default instead of duplicating it. For custom head templates that omit a title, the default "Boxel" is added automatically so the document always has exactly one<title>.