feat: allow robots

This commit is contained in:
tresabhi committed 2024-11-17 12:29:57 -06:00
1 parent b54d4a59cf
commit b9895b1c0f
2 files changed
+15 -13

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ env:
PUBLIC_ASSET_REPO: ${{ secrets.PUBLIC_ASSET_REPO }}
PUBLIC_ASSET_BRANCH: ${{ secrets.PUBLIC_ASSET_BRANCH }}
PUBLIC_PROMOTE_OPENTEST: ${{ secrets.PUBLIC_PROMOTE_OPENTEST }}
ALLOW_ROBOTS: ${{ secrets.ALLOW_ROBOTS }}
ALLOW_ROBOTS: true
WOTB_GLOSSARY: ${{ secrets.WOTB_GLOSSARY }}
jobs:
+14 -12
View File
@@ -5,17 +5,19 @@ export async function GET({}: APIContext) {
const allowRobots = assertSecret(import.meta.env.ALLOW_ROBOTS) === 'true';
const site = assertSecret(import.meta.env.SITE);
return new Response(`
User-agent: *
${allowRobots ? 'Allow' : 'Disallow'}: /
return new Response(
`
User-agent: *
${allowRobots ? 'Allow' : 'Disallow'}: /
${
allowRobots
? `
Host: ${site}
Sitemap: ${site}/sitemap-index.xml
`
: ''
}
`);
${
allowRobots
? `
Host: ${site}
Sitemap: ${site}/sitemap-index.xml
`
: ''
}
`.trim(),
);
}