remix-seo
remix-seo copied to clipboard
Consume route manifest from server build instead of context
Perhaps surprisingly, you can import the server build in any route module, like this:
import * as build from '@remix-run/dev/server-build'
import { useLoaderData } from '@remix-run/react'
export function loader() {
return Object.keys(build.routes)
}
export default function () {
const routes = useLoaderData<typeof loader>()
return (
<>
<h1>List of routes</h1>
<ul>
{routes.map((route) => (
<li key={route}>{route}</li>
))}
</ul>
</>
)
}
As a result, customizing the Remix server entry point is not necessary.
See https://github.com/remix-run/remix/discussions/2912#discussioncomment-7013261