Skip to content

feat(schema,nuxt): add configurable unhead.templateParams option#35137

Draft
harlan-zw wants to merge 1 commit into
mainfrom
feat/unhead-template-params
Draft

feat(schema,nuxt): add configurable unhead.templateParams option#35137
harlan-zw wants to merge 1 commit into
mainfrom
feat/unhead-template-params

Conversation

@harlan-zw

@harlan-zw harlan-zw commented May 21, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

📚 Description

Adds a configurable unhead.templateParams option controlling unhead's TemplateParamsPlugin.

The plugin resolves %s / %siteName / %separator title interpolation in head tags. unhead v3 no longer auto-loads it. This makes the behaviour configurable and compat-version aware:

  • compatibilityVersion: 5 — defaults to false, aligning with unhead v3 (no auto-load).
  • v4 / legacy — defaults to true, kept for back-compat via legacyPlugins.
  • An explicit boolean always wins:
export default defineNuxtConfig({
  unhead: {
    templateParams: true, // force-enable on v5
  },
})

When disabled on v5, the TemplateParamsPlugin import and registration are skipped from the generated unhead.config.mjs.

Extracted from the SSR streaming branch so it can be reviewed independently.

@github-actions github-actions Bot added agentscan:mixed-signals 5.x ✨ enhancement New feature or improvement to existing functionality labels May 21, 2026
@pkg-pr-new

pkg-pr-new Bot commented May 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@35137

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@35137

nuxt

npm i https://pkg.pr.new/nuxt@35137

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@35137

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@35137

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@35137

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@35137

commit: 7de83c9

Allow controlling unhead's `TemplateParamsPlugin` (which resolves
`%s` / `%siteName` / `%separator` title interpolation) via
`unhead.templateParams`.

Defaults to `false` on `compatibilityVersion: 5` (aligning with unhead
v3, which no longer auto-loads the plugin) and `true` on v4/legacy. An
explicit boolean always wins.
@harlan-zw harlan-zw force-pushed the feat/unhead-template-params branch from 3d279f1 to 7de83c9 Compare May 21, 2026 04:33
@codspeed-hq

codspeed-hq Bot commented May 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing feat/unhead-template-params (7de83c9) with main (18b6611)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x agentscan:mixed-signals ✨ enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant