diff --git a/www/.env.example b/www/.env.example index fb28bfe..b7818e2 100644 --- a/www/.env.example +++ b/www/.env.example @@ -1 +1,2 @@ PUBLIC_AIA_API_BASE=https://api.azinstitute4autism.com +PUBLIC_ALLOW_INDEXING=false diff --git a/www/README.md b/www/README.md index bfc3dcd..dd00160 100644 --- a/www/README.md +++ b/www/README.md @@ -38,19 +38,23 @@ cd www npm install ``` -Copy the example environment file when testing the like/view counter: +Copy the example environment file when testing the like/view counter or staging +SEO behavior: ```sh cp .env.example .env ``` -The default value is: +The default values are: ```txt PUBLIC_AIA_API_BASE=https://api.azinstitute4autism.com +PUBLIC_ALLOW_INDEXING=false ``` -The site still renders when that API is unavailable. +The site still renders when the AIA API is unavailable. Migration and staging +builds emit `noindex,nofollow` by default; set `PUBLIC_ALLOW_INDEXING=true` +only for production builds on the canonical domain. ## View And Build diff --git a/www/public/robots.txt b/www/public/robots.txt deleted file mode 100644 index b0fe257..0000000 --- a/www/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -User-agent: * -Allow: / -Sitemap: https://www.azinstitute4autism.com/sitemap.xml diff --git a/www/src/components/Seo.astro b/www/src/components/Seo.astro index c776d0e..497146a 100644 --- a/www/src/components/Seo.astro +++ b/www/src/components/Seo.astro @@ -6,12 +6,23 @@ interface Props { image?: string; lang?: string; type?: 'website' | 'article'; + robots?: string; } -const { title, description = '', canonical, image, lang = 'en', type = 'website' } = Astro.props; +const { + title, + description = '', + canonical, + image, + lang = 'en', + type = 'website', + robots +} = Astro.props; +const defaultRobots = import.meta.env.PUBLIC_ALLOW_INDEXING === 'true' ? 'index,follow' : 'noindex,nofollow'; const absoluteImage = image ? new URL(image, Astro.site ?? Astro.url).href : undefined; ---