diff --git a/README.md b/README.md index 15581e128..da6ce8ef5 100644 --- a/README.md +++ b/README.md @@ -24,19 +24,18 @@ If you intend to contribute to the code, note that you may need to check out sen ## Environment Variables -| Name | Source | BlitzKit Default | Memo | -| ------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | -| `PUBLIC_WARGAMING_APPLICATION_ID` | [Wargaming Developer's Room](https://developers.wargaming.net/) | | Application ID needed to communicate with Wargaming APIs. | -| `PUBLIC_PROMOTE_OPENTEST` | | `false` | Optional boolean dictating whether the website advertises [the opentest subdomain of BlitzKit](https://opentest.blitzkit.app/). | -| `ALLOW_ROBOTS` | | `true` | Toggles between `Allow: /` and `Disallow: /` in the website's `/robots.txt`. This is usually `false` for all BlitzKit's subdomains. | -| `WOTB_GLOSSARY`, `WOTB_GLOSSARY_DOMAIN`, `WOTB_GLOSSARY_PATH` | | | | -| `PUBLIC_GOOGLE_TAG_MANAGER_ID` | [Google Tag Manager](https://tagmanager.google.com/) | `G-GL2JVHCGPQ` | Google Tag Manager's unique identifier for analytical purposes. | -| `PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID` | [Google Analytics](https://analytics.google.com/) | `430711767` | Google Analytics' unique property ID for [BlitzKit's apex domain](https://blitzkit.app/) and subdomains. | -| `GOOGLE_APPLICATION_CREDENTIALS` | [Google Cloud](https://cloud.google.com/) | | Google Cloud's API key, primarily used for ranking popular tanks and finding relevant tank review videos in Tankopedia. | -| `PUBLIC_DISCORD_SERVER_ID` | [BlitzKit Discord Server](https://discord.gg/nDt7AjGJQH) | `734786591205359697` | BlitzKit Discord Server's id. | -| `PUBLIC_ASSET_BASE` | [blitzkit/assets](https://github.com/blitzkit/assets) | `https://blitzkit.github.io/assets` | The root domain and path that serves the external assets like tank models and icons. | -| `PUBLIC_GUIDE_WEBSITE` | [GuidesBlitz](https://guidesblitz.com/) | `https://guidesblitz.com` | The website that serves the encyclopedia-like content in BlitzKit. | -| `SERVICING` | | `false` | Wether the website is down for servicing. | -| `GH_TOKEN` | [GitHub Fine-Grained Tokens](https://github.com/settings/personal-access-tokens) | | The GitHub API key used for checking out private submodules and pushing content to the asset repository. | -| `DATABASE_URL` | [CockroachDB](https://www.cockroachlabs.com/) | | The CockroachDB-SQL database URL used to link Wargaming and Discord users. | -| `WOTB_DLC_CDN` | | | | +| Name | Source | BlitzKit Default | Memo | +| ------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | +| `PUBLIC_WARGAMING_APPLICATION_ID` | [Wargaming Developer's Room](https://developers.wargaming.net/) | | Application ID needed to communicate with Wargaming APIs. | +| `PUBLIC_PROMOTE_OPENTEST` | | `false` | Optional boolean dictating whether the website advertises [the opentest subdomain of BlitzKit](https://opentest.blitzkit.app/). | +| `WOTB_GLOSSARY`, `WOTB_GLOSSARY_DOMAIN`, `WOTB_GLOSSARY_PATH` | | | | +| `PUBLIC_GOOGLE_TAG_MANAGER_ID` | [Google Tag Manager](https://tagmanager.google.com/) | `G-GL2JVHCGPQ` | Google Tag Manager's unique identifier for analytical purposes. | +| `PUBLIC_GOOGLE_ANALYTICS_PROPERTY_ID` | [Google Analytics](https://analytics.google.com/) | `430711767` | Google Analytics' unique property ID for [BlitzKit's apex domain](https://blitzkit.app/) and subdomains. | +| `GOOGLE_APPLICATION_CREDENTIALS` | [Google Cloud](https://cloud.google.com/) | | Google Cloud's API key, primarily used for ranking popular tanks and finding relevant tank review videos in Tankopedia. | +| `PUBLIC_DISCORD_SERVER_ID` | [BlitzKit Discord Server](https://discord.gg/nDt7AjGJQH) | `734786591205359697` | BlitzKit Discord Server's id. | +| `PUBLIC_ASSET_BASE` | [blitzkit/assets](https://github.com/blitzkit/assets) | `https://blitzkit.github.io/assets` | The root domain and path that serves the external assets like tank models and icons. | +| `PUBLIC_GUIDE_WEBSITE` | [GuidesBlitz](https://guidesblitz.com/) | `https://guidesblitz.com` | The website that serves the encyclopedia-like content in BlitzKit. | +| `SERVICING` | | `false` | Wether the website is down for servicing. | +| `GH_TOKEN` | [GitHub Fine-Grained Tokens](https://github.com/settings/personal-access-tokens) | | The GitHub API key used for checking out private submodules and pushing content to the asset repository. | +| `DATABASE_URL` | [CockroachDB](https://www.cockroachlabs.com/) | | The CockroachDB-SQL database URL used to link Wargaming and Discord users. | +| `WOTB_DLC_CDN` | | | | diff --git a/environments/beta.json b/environments/beta.json index bc2910448..d5ff3f5d5 100644 --- a/environments/beta.json +++ b/environments/beta.json @@ -1,4 +1,7 @@ { + "robots": false, + "canonical": "https://blitzkit.app", + "paths": { "default": null, "api": null diff --git a/environments/development.json b/environments/development.json index 06aff4bef..742768ff4 100644 --- a/environments/development.json +++ b/environments/development.json @@ -1,4 +1,7 @@ { + "robots": false, + "canonical": "https://blitzkit.app", + "paths": { "default": null, "api": "api" diff --git a/environments/opentest.json b/environments/opentest.json index 4857ad043..0c29b792f 100644 --- a/environments/opentest.json +++ b/environments/opentest.json @@ -1,4 +1,7 @@ { + "robots": false, + "canonical": "https://blitzkit.app", + "paths": { "default": null, "api": null diff --git a/environments/preview.json b/environments/preview.json index 79a76960b..a3d980559 100644 --- a/environments/preview.json +++ b/environments/preview.json @@ -1,4 +1,7 @@ { + "robots": false, + "canonical": "https://blitzkit.app", + "paths": { "default": null, "api": null diff --git a/environments/production.json b/environments/production.json index 17e40a56b..89d8e9a5e 100644 --- a/environments/production.json +++ b/environments/production.json @@ -1,4 +1,7 @@ { + "robots": true, + "canonical": "https://blitzkit.app", + "paths": { "default": null, "api": null diff --git a/packages/core/src/blitzkit/environment.ts b/packages/core/src/blitzkit/environment.ts index 077dd0d20..633fe76b2 100644 --- a/packages/core/src/blitzkit/environment.ts +++ b/packages/core/src/blitzkit/environment.ts @@ -1,6 +1,8 @@ import { assertSecret } from "@blitzkit/core"; interface EnvironmentConfig { + robots: boolean; + canonical: string; paths: Record; nodes: Record; aliases: Record; diff --git a/packages/website/src/pages/robots.txt.ts b/packages/website/src/pages/robots.txt.ts index e056aa4a8..a051e9ad7 100644 --- a/packages/website/src/pages/robots.txt.ts +++ b/packages/website/src/pages/robots.txt.ts @@ -1,20 +1,22 @@ -import type { APIContext } from 'astro'; - -const ALLOW_ROBOTS = import.meta.env.ALLOW_ROBOTS; +import { environmentConfig } from "@blitzkit/core"; +import type { APIContext } from "astro"; export async function GET({ request }: APIContext) { + const config = environmentConfig(); + const flags: Record = { - 'User-agent': '*', - Allow: ALLOW_ROBOTS ? '/' : null, - Disallow: ALLOW_ROBOTS ? null : '/', + "User-agent": "*", + Allow: config.robots ? "/" : null, + Disallow: config.robots ? null : "/", space: null, + Sitemap: `${new URL(request.url).origin}/sitemap-index.xml`, }; return new Response( Object.entries(flags) - .map(([key, value]) => (value === null ? '' : `${key}: ${value}`)) - .join('\n'), + .map(([key, value]) => (value === null ? "" : `${key}: ${value}`)) + .join("\n"), ); }