TanStackT
TanStack5mo ago
1 reply
foolish-indigo

custom metadata field on createFileRoute

hello tanstack, I'm working on a project where I'd like to generate clickable previews for different pages based on metadata from the file system routing. essentially, i'd like to have an app name, an icon, and perhaps a description for use in a launcher for internal apps at work.

Is there a way to define this inside the createFileRoute? By using the head property, i can add certain metadata and introspect it at build time by reading the generated routeTree object, but this will end up inserting it into my html. Is there a better place to define build time metadata associated with a route?

Or a way to extend my router to enable this in a type safe way? I've attached 2 screenshots of how i'm reading / writing to the head property currently
image.png
image.png
Was this page helpful?