Skip to content

Commit 8127c1f

Browse files
committed
Change permissions for previews
1 parent a7b309f commit 8127c1f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

public/robots.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/pages/robots.txt.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { APIRoute } from "astro";
2+
3+
const previewRobots = `
4+
User-agent: *
5+
Disallow: /
6+
`;
7+
8+
const prodRobots = `
9+
User-agent: *
10+
Disallow: /_astro/
11+
Disallow: /*?
12+
Allow: /
13+
14+
Sitemap: https://ep2025.europython.eu/sitemap-index.xml
15+
`;
16+
17+
const isPreview = import.meta.env.PREVIEW?.toLowerCase() === "true";
18+
export const GET: APIRoute = () =>
19+
new Response(isPreview ? previewRobots : prodRobots);

0 commit comments

Comments
 (0)