Skip to content

Commit a09fc4c

Browse files
authored
Add robots.txt (#1060)
1 parent 0914eb1 commit a09fc4c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.github/workflows/preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: make install
3434

3535
- name: Build the website
36-
run: make build
36+
run: make build PREVIEW=true
3737

3838
- name: Set up SSH key
3939
uses: webfactory/[email protected]

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 = String(import.meta.env.PREVIEW).toLowerCase() === "true";
18+
export const GET: APIRoute = () =>
19+
new Response(isPreview ? previewRobots : prodRobots);

0 commit comments

Comments
 (0)