v3.1.0
What's Changed
New Experimental Way to Use the Sitemap/Robots Generator
- Create a
lib/sitemap.ts
file
// lib/sitemap.ts
export const { experimental_sitemap, robots } = createSitemapGenerator({
siteUrl: 'https://example.com',
// configure other things here
})
- Create a
sitemap[.]xml
route
// app/routes/sitemap[.]xml.tsx
import { routes } from '@remix-run/dev/server-build';
import { experimental_sitemap } from '~/lib/sitemap';
export const loader: LoaderFunction = async ({ request }) => {
return await experimental_sitemap(request, routes);
}
- Create a
robots[.]txt
route
// app/routes/robots[.]txt.tsx
import { robots } from '~/lib/sitemap';
export const loader: LoaderFunction = ({ request }) => {
return robots();
}
Full Changelog: v3.0.1...v3.1.0