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:
5 files changed
+43
-7
No files matched your search
@@ -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} />
|
||||
|
||||
Reference in new issue
Block a user