TanStackT
TanStack16mo ago
2 replies
verbal-lime

Correct way to add favicon?

Hello, I'm wondering what's the correct way to add favicon?

While looking at examples, I see that most of the metadata are added through meta in createRootRoute, but after trying for a while, I cannot figure out what to put there to render <link />.

The only way I managed to add favicon in a way that is actually displayed is through this code inside RootDocument:
<Meta>
  <link
    rel="icon"
    href="/favicon/favicon.svg"
    type="image/svg"
    sizes="any"
  />
</Meta>


But I feel this is not the right way to do this. First of all, this adds the <link/> to <head> twice in the actual html. Plus I feel this would make it impossible to display different favicons for different routes, which doesn't feel right.
Was this page helpful?