Skip to content

v3.1.0

Compare
Choose a tag to compare
@fedeya fedeya released this 29 Oct 21:38
· 5 commits to canary since this release

What's Changed

  • feat: add new experimental function to use server build in runtime by @fedeya in #60

New Experimental Way to Use the Sitemap/Robots Generator

  1. Create a lib/sitemap.ts file
// lib/sitemap.ts
export const { experimental_sitemap, robots } = createSitemapGenerator({
  siteUrl: 'https://example.com',
  // configure other things here
})
  1. 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);
}
  1. 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