Skip to content
Source
Sign inSign up
TanStack/router

Set multiple 'theme-color' in head #5146

Send to my agent
Openviclafouch(GitHub profile, opens in a new tab) opened this issue 3 comments

Which project does this relate to?

Router

Describe the bug

Following the doc of MDN : https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta/name/theme-color

I would like to add 2 meta tags with the same name.

<meta
  name="theme-color"
  content="cornflowerblue"
  media="(prefers-color-scheme: light)" />
<meta
  name="theme-color"
  content="dimgray"
  media="(prefers-color-scheme: dark)" />

But TanStack router says : "meta tags with the same name or property will be overridden by the last occurrence of that tag found in nested routes" Src : https://tanstack.com/router/v1/docs/framework/react/guide/document-head-management

So how to handle my use case ?

Your Example Website or App

https://codesandbox.io/p/devbox/pedantic-poitras-7hrmrd?workspaceId=ws_VUPqXCcptK4abDwy6H7mEq

Steps to Reproduce the Bug or Issue

  1. Go to https://codesandbox.io/p/devbox/pedantic-poitras-7hrmrd?workspaceId=ws_VUPqXCcptK4abDwy6H7mEq
  2. Check head tag
  3. Check that there is only 1 "theme-color" tag instead of 2.

Expected behavior

As a user, I expect to see 2 theme color meta tags

Screenshots or Videos

No response

Platform

  • Router / Start Version: Last version

Additional context

No response

  1. It should skip de-duplicating og:locale:alternate as well. Or it should actually see if the property and the content is the same before duduplicating.

  2. schiller-manuel(GitHub profile, opens in a new tab) added labelsstart-head

  3. I'm having this issue. I'm not able to add two meta tags for theme-color with different prefers-color-scheme media query. The router only renders the last one.

  4. Same, I would like to use multiple og:image tags, but TanStack's deduplication is too aggressive

Sign in to join this conversation.