Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
import type { LoaderFunctionArgs } from "react-router";
import { sitemap } from "__SITEMAP__";
export const loader = (arg: LoaderFunctionArgs) => {
const host =
arg.request.headers.get("x-forwarded-host") ||
arg.request.headers.get("host") ||
"";
const urls = sitemap.map((page) => {
const url = new URL(`https://${host}${page.path}`);
return `
<url>
<loc>${url.href}</loc>
<lastmod>${page.lastModified.split("T")[0]}</lastmod>
</url>
`;
});
return new Response(
`<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${urls.join("")}
</urlset>
`,
{
headers: {
"Content-Type": "application/xml",
},
status: 200,
}
);
};