mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
refactor: use new astro env (#507)
* refactor: use new astro env * chore: directly use PUBLIC_GOOGLE_SITE_VERIFICATION
This commit is contained in:
+10
-1
@@ -1,4 +1,4 @@
|
||||
import { defineConfig } from "astro/config";
|
||||
import { defineConfig, envField } from "astro/config";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import sitemap from "@astrojs/sitemap";
|
||||
import remarkToc from "remark-toc";
|
||||
@@ -32,6 +32,15 @@ export default defineConfig({
|
||||
// Used for all `<Image />` and `<Picture />` components unless overridden with a prop
|
||||
experimentalLayout: "responsive",
|
||||
},
|
||||
env: {
|
||||
schema: {
|
||||
PUBLIC_GOOGLE_SITE_VERIFICATION: envField.string({
|
||||
access: "public",
|
||||
context: "client",
|
||||
optional: true,
|
||||
}),
|
||||
},
|
||||
},
|
||||
experimental: {
|
||||
svg: true,
|
||||
responsiveImages: true,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
---
|
||||
import { ClientRouter } from "astro:transitions";
|
||||
import { PUBLIC_GOOGLE_SITE_VERIFICATION } from "astro:env/client";
|
||||
import { SITE } from "@/config";
|
||||
import "@/styles/global.css";
|
||||
|
||||
const googleSiteVerification = import.meta.env.PUBLIC_GOOGLE_SITE_VERIFICATION;
|
||||
|
||||
export interface Props {
|
||||
title?: string;
|
||||
author?: string;
|
||||
@@ -117,10 +116,10 @@ const structuredData = {
|
||||
// If PUBLIC_GOOGLE_SITE_VERIFICATION is set in the environment variable,
|
||||
// include google-site-verification tag in the heading
|
||||
// Learn more: https://support.google.com/webmasters/answer/9008080#meta_tag_verification&zippy=%2Chtml-tag
|
||||
googleSiteVerification && (
|
||||
PUBLIC_GOOGLE_SITE_VERIFICATION && (
|
||||
<meta
|
||||
name="google-site-verification"
|
||||
content={googleSiteVerification}
|
||||
content={PUBLIC_GOOGLE_SITE_VERIFICATION}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user