diff --git a/packages/react-router/src/HeadContent.tsx b/packages/react-router/src/HeadContent.tsx index 6330e5a7495..71738634d05 100644 --- a/packages/react-router/src/HeadContent.tsx +++ b/packages/react-router/src/HeadContent.tsx @@ -4,6 +4,12 @@ import { useRouter } from './useRouter' import { useRouterState } from './useRouterState' import type { RouterManagedTag } from '@tanstack/router-core' +const METAS_TO_ALLOW_MULTIPLE = new Set(['theme-color']) + +function shouldDeduplicateMetaTag(attribute: string) { + return METAS_TO_ALLOW_MULTIPLE.has(attribute) === false +} + /** * Build the list of head/link/meta/script tags to render for active matches. * Used internally by `HeadContent`. @@ -37,7 +43,10 @@ export const useTags = () => { } else { const attribute = m.name ?? m.property if (attribute) { - if (metaByAttribute[attribute]) { + if ( + metaByAttribute[attribute] && + shouldDeduplicateMetaTag(attribute) + ) { continue } else { metaByAttribute[attribute] = true