mirror of
https://github.com/KazooTTT/kazoottt-blog-v2.git
synced 2025-06-23 10:41:30 +08:00
feat: Enhance BaseHead and Note page metadata with Google Analytics and improved description
This commit is contained in:
@ -89,6 +89,18 @@ const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url
|
|||||||
|
|
||||||
<meta name="baidu-site-verification" content="codeva-ZWUil8ENc0" />
|
<meta name="baidu-site-verification" content="codeva-ZWUil8ENc0" />
|
||||||
<meta name="google-adsense-account" content="ca-pub-6184816340945344" />
|
<meta name="google-adsense-account" content="ca-pub-6184816340945344" />
|
||||||
|
<!-- Google tag (gtag.js) -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-F4KLD4XCDB"></script>
|
||||||
|
<script>
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
|
gtag("js", new Date());
|
||||||
|
|
||||||
|
gtag("config", "G-F4KLD4XCDB");
|
||||||
|
</script>
|
||||||
|
|
||||||
<script
|
<script
|
||||||
async
|
async
|
||||||
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6184816340945344"
|
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6184816340945344"
|
||||||
@ -108,17 +120,6 @@ const socialImageURL = new URL(ogImage ? ogImage : "/social-card.png", Astro.url
|
|||||||
y.parentNode.insertBefore(t, y);
|
y.parentNode.insertBefore(t, y);
|
||||||
})(window, document, "clarity", "script", "kvbyuhu6d2");
|
})(window, document, "clarity", "script", "kvbyuhu6d2");
|
||||||
</script>
|
</script>
|
||||||
<!-- Google tag (gtag.js) -->
|
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-F4KLD4XCDB"></script>
|
|
||||||
<script>
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag() {
|
|
||||||
dataLayer.push(arguments);
|
|
||||||
}
|
|
||||||
gtag("js", new Date());
|
|
||||||
|
|
||||||
gtag("config", "G-F4KLD4XCDB");
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<meta content={Astro.generator} name="generator" />
|
<meta content={Astro.generator} name="generator" />
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import { getCollection } from "astro:content";
|
|||||||
import Note from "@/components/note/Note.astro";
|
import Note from "@/components/note/Note.astro";
|
||||||
import PageLayout from "@/layouts/Base.astro";
|
import PageLayout from "@/layouts/Base.astro";
|
||||||
import type { GetStaticPaths, InferGetStaticPropsType } from "astro";
|
import type { GetStaticPaths, InferGetStaticPropsType } from "astro";
|
||||||
|
import { siteConfig } from "@/site.config";
|
||||||
|
|
||||||
// if you're using an adaptor in SSR mode, getStaticPaths wont work -> https://docs.astro.build/en/guides/routing/#modifying-the-slug-example-for-ssr
|
// if you're using an adaptor in SSR mode, getStaticPaths wont work -> https://docs.astro.build/en/guides/routing/#modifying-the-slug-example-for-ssr
|
||||||
export const getStaticPaths = (async () => {
|
export const getStaticPaths = (async () => {
|
||||||
@ -20,7 +21,8 @@ const { note } = Astro.props;
|
|||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
description:
|
description:
|
||||||
note.data.description || `Read about my note posted on: ${note.data.date.toLocaleDateString()}`,
|
note.data.description ||
|
||||||
|
`Read about my note posted on ${siteConfig.title} (${siteConfig.description}) at ${note.data.date.toLocaleDateString()} by ${siteConfig.author}`,
|
||||||
title: note.data.title,
|
title: note.data.title,
|
||||||
tags: note.data.tags.join(", "),
|
tags: note.data.tags.join(", "),
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user