28 lines
642 B
TypeScript
28 lines
642 B
TypeScript
import { LoaderFunctionArgs } from "@remix-run/node";
|
|
|
|
export async function loader({ request }: LoaderFunctionArgs) {
|
|
const baseUrl = new URL(request.url).origin;
|
|
|
|
const robotsContent = `User-agent: *
|
|
Allow: /
|
|
Disallow: /profile/
|
|
Disallow: /cart/
|
|
Disallow: /store/*/setting
|
|
Disallow: /store/*/orders
|
|
Disallow: /store/*/financial-dashboard
|
|
Disallow: /logout
|
|
|
|
# Sitemap
|
|
Sitemap: ${baseUrl}/sitemap.xml
|
|
|
|
# Crawl-delay for courtesy
|
|
Crawl-delay: 1`;
|
|
|
|
return new Response(robotsContent, {
|
|
status: 200,
|
|
headers: {
|
|
"Content-Type": "text/plain",
|
|
"Cache-Control": "public, max-age=86400", // Cache for 24 hours
|
|
},
|
|
});
|
|
} |