refactor: use new astro env (#507)

* refactor: use new astro env

* chore: directly use PUBLIC_GOOGLE_SITE_VERIFICATION
This commit is contained in:
Tanishq Manuja
2025-06-07 15:06:02 +05:30
committed by GitHub
parent 4d01654471
commit 852d3b81ba
2 changed files with 13 additions and 5 deletions
+10 -1
View File
@@ -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,
+3 -4
View File
@@ -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}
/>
)
}