[feature]: Expose Remix Context to loaders?
See original GitHub issueI was converting a bunch of my old “other routes” to resource routes: https://github.com/kentcdodds/kentcdodds.com/commit/514d834d18ca8111a6c128ef101eddde45f43b9f
It was awesome, except for my sitemap.xml route which needs the remixContext to work: https://github.com/kentcdodds/kentcdodds.com/blob/514d834d18ca8111a6c128ef101eddde45f43b9f/app/utils/sitemap.server.ts#L22
The way my sitemap works is it goes through all the route modules and includes them in the sitemap. There’s a default for each route, but there’s also the ability for routes to add a custom getSitemapEntries function on handle: https://github.com/kentcdodds/kentcdodds.com/blob/514d834d18ca8111a6c128ef101eddde45f43b9f/app/utils/sitemap.server.ts#L29
It works really well: https://kentcdodds.com/sitemap.xml
Eventually this could be an open source module that people could easily install and include on their site:
// app/routes/sitemap[.]xml.tsx
export {loader} from 'remix-sitemap'
I’m not sure whether there’s any other way to get access to all the route modules, but in any case, my loader needs access to the route modules as well as the manifest.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:8 (4 by maintainers)

Top Related StackOverflow Question
That won’t work for me because I want to send an XML document, not a React component 😃
Should there be a new issue for this sitemap functionality?