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

1 Reply
fair-roseOP•2mo ago
https://tanstack.com/router/latest/docs/framework/react/guide/static-route-data#enforcing-static-data hm, this may be the static data
Static Route Data | TanStack Router React Docs
When creating routes, you can optionally specify a staticData property in the route's options. This object can literally contain anything you want as long as it's synchronously available when you crea...