Skip to content

Pages Router next/head: emits data-vinext-head and ignores charset/_document.getInitialProps merge order #1475

Description

@james-elicx

This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-22).

Problem

Tags injected via Pages Router <Head> are emitted with data-vinext-head="true" instead of Next.js's data-next-head="". The charset/viewport ordering does not match Next.js, and _document.getInitialProps() head merging is missing, so downstream _document tag lookups fail.

Expected attribute `data-next-head`, received `data-vinext-head`; charset/viewport ordering wrong

Estimated Impact

~2 test failures across the deploy suite.

Affected Test Suites

  • test/e2e/next-head/index.test.ts (2 failures)

Recommendation

  1. Reproduce first in vinext's own test suite. Render a Pages Router page using next/head and assert the emitted tags have data-next-head="" and that charset/viewport appear in the Next.js canonical order.

  2. Rename the attribute. Replace data-vinext-head with data-next-head in the Pages Router head shim.

  3. Merge _document.getInitialProps() head tags. Include tags returned from _document.getInitialProps() ahead of next/head user tags, in the order Next.js uses.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions