Skip to content

Commit abd260a

Browse files
Programcodeclaude
andcommitted
Add sitemap.xml and fix Nginx routing for SEO files
- Create public/sitemap.xml with all public routes (/, /terms, /privacy, /login) - Add Sitemap directive to robots.txt - Add explicit Nginx location block for /sitemap.xml with application/xml content type - Harden robots.txt Nginx block with try_files and explicit text/plain type - Prevents SPA fallback from serving index.html for /sitemap.xml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ff4be54 commit abd260a

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

‎nginx.conf‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,17 @@ server {
2121
add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
2222
}
2323

24-
# Allow robots.txt
24+
# SEO: Serve robots.txt and sitemap.xml directly (bypass SPA fallback and .txt block)
2525
location = /robots.txt {
2626
allow all;
27+
default_type text/plain;
28+
try_files $uri =404;
29+
}
30+
31+
location = /sitemap.xml {
32+
allow all;
33+
default_type application/xml;
34+
try_files $uri =404;
2735
}
2836

2937
# SECURITY: Block access to sensitive files

‎public/robots.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ Allow: /
1212

1313
User-agent: *
1414
Allow: /
15+
16+
Sitemap: https://debate.pi-stack.org/sitemap.xml

‎public/sitemap.xml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3+
<url>
4+
<loc>https://debate.pi-stack.org/</loc>
5+
<changefreq>weekly</changefreq>
6+
<priority>1.0</priority>
7+
</url>
8+
<url>
9+
<loc>https://debate.pi-stack.org/terms</loc>
10+
<changefreq>monthly</changefreq>
11+
<priority>0.3</priority>
12+
</url>
13+
<url>
14+
<loc>https://debate.pi-stack.org/privacy</loc>
15+
<changefreq>monthly</changefreq>
16+
<priority>0.3</priority>
17+
</url>
18+
<url>
19+
<loc>https://debate.pi-stack.org/login</loc>
20+
<changefreq>monthly</changefreq>
21+
<priority>0.5</priority>
22+
</url>
23+
</urlset>

0 commit comments

Comments
 (0)