Skip to content

Commit e3f0290

Browse files
committed
docs: add site verification meta tag support for other search engines
1 parent 719d9a7 commit e3f0290

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

apps/docs/astro.config.mjs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
import { defineConfig } from 'astro/config'
22
import starlight from '@astrojs/starlight'
33

4-
const SITE = 'https://css-variants.vercel.app'
4+
const site = 'https://css-variants.vercel.app'
55

66
/** @type {import('@astrojs/starlight/types').StarlightConfig['head']} */
77
const head = [
88
{
99
tag: 'meta',
10-
attrs: { property: 'og:image', content: SITE + '/og-image.svg' },
10+
attrs: { property: 'og:image', content: site + '/og-image.svg' },
1111
},
1212
{
1313
tag: 'meta',
14-
attrs: { name: 'twitter:image', content: SITE + '/og-image.svg' },
14+
attrs: { name: 'twitter:image', content: site + '/og-image.svg' },
1515
},
1616
]
1717

18-
if (process.env.GOOGLE_SITE_VERIFICATION) {
19-
head.push({
20-
tag: 'meta',
21-
attrs: {
22-
name: 'google-site-verification',
23-
content: process.env.GOOGLE_SITE_VERIFICATION,
24-
},
25-
})
18+
const siteVerifications = [
19+
{ name: 'google-site-verification', env: 'GOOGLE_SITE_VERIFICATION' },
20+
{ name: 'msvalidate.01', env: 'BING_SITE_VERIFICATION' },
21+
{ name: 'yandex-verification', env: 'YANDEX_SITE_VERIFICATION' },
22+
{ name: 'baidu-site-verification', env: 'BAIDU_SITE_VERIFICATION' },
23+
]
24+
for (const { name, env } of siteVerifications) {
25+
const value = process.env[env]
26+
27+
if (value) {
28+
head.push({ tag: 'meta', attrs: { name, content: value } })
29+
}
2630
}
2731

2832
export default defineConfig({
29-
site: SITE,
33+
site,
3034
integrations: [
3135
starlight({
3236
title: 'css-variants',

0 commit comments

Comments
 (0)