Skip to content

Empty LD+JSON head script when set from layout. #6627

@AlexandreSi

Description

@AlexandreSi

Which project does this relate to?

Router

Describe the bug

Hi there,

Thank you for your work on this great framework!

I'm using the head attribute of my route in order to set Structured data (LD+JSON). In my use case, I set it from a layout file.

When creating the minimal bug reproducing project, I noticed that it worked at one point and stopped working then: sometimes there were 2 script tags with one empty, and after it was a single empty one.

Your Example Website or App

https://github.com/AlexandreSi/minimal-tanstack-start-project

Steps to Reproduce the Bug or Issue

  1. Clone the project

  2. Start with npm run dev

  3. Navigate to /about

  4. Open dev tools and check in the head tag that the script tag is empty

  5. If not empty, try refreshing or hot-reloading with a code change

    Image

Expected behavior

I was expecting the script tag to look like something like that:

<script type="application/ld+json">{"@context":"https://schema.org","@type":"LocalBusiness","name":"Donut All Day","location":[{"@type":"Place","address":"123 Glazed street","name":"Donut All Day Glazed street","latitude":45,"longitude":5}]}</script>

Screenshots or Videos

No response

Platform

  • Router / Start Version: Check the package.json (project created with npx @tanstack/cli create on 2026-02-10)
  • OS: macOS
  • Browser: Chrome
  • Browser Version: 144.0.7559.133
  • Bundler: vite
  • Bundler Version: 7.3.1

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions