fix(seo): noindex staging builds by default

- add PUBLIC_ALLOW_INDEXING as an explicit production indexing opt-in
- emit robots meta noindex,nofollow unless indexing is enabled
- generate robots.txt from the same indexing flag
- document staging SEO behavior for migration preview hosts
This commit is contained in:
DeCentN2Madness committed 2026-07-13 12:48:14 -07:00
1 parent 9c391c8c05
commit 6648d1d7d5
5 files changed
+43 -7

No files matched your search

+12 -1
View File
@@ -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;
---
<title>{title}</title>
<meta name="description" content={description} />
<meta name="robots" content={robots ?? defaultRobots} />
{canonical && <link rel="canonical" href={canonical} />}
<meta property="og:type" content={type} />
<meta property="og:title" content={title} />