Commit 3b1429e

HPCesia <me@hpcesia.com>
2026-03-11 08:03:08
More meta tags
1 parent 4f65d37
Changed files (3)
src/layouts/GlobalLayout.astro
@@ -8,12 +8,14 @@ interface Props {
   title?: string;
   author?: string;
   description?: string;
+  isArticle?: boolean;
 }
 
 const {
   title = SITE_CONFIG.title,
   author = SITE_CONFIG.author,
   description = SITE_CONFIG.description,
+  isArticle = false,
 } = Astro.props;
 ---
 
@@ -31,9 +33,13 @@ const {
     <meta name="description" content={description} />
     <meta name="author" content={author} />
 
+    <meta property="og:url" content={Astro.url} />
+    <meta property="og:site_name" content={SITE_CONFIG.title} />
     <meta property="og:title" content={title} />
     <meta property="og:description" content={description} />
+    <meta property="og:type" content={isArticle ? "article" : "website"} />
 
+    <meta property="twitter:card" content="summary" />
     <meta property="twitter:title" content={title} />
     <meta property="twitter:description" content={description} />
 
src/pages/posts/[slug].astro
@@ -20,7 +20,12 @@ const data = entry.data;
 const { Content } = await render(entry);
 ---
 
-<GlobalLayout title={data.title} author={data.author} description={data.desc}>
+<GlobalLayout
+  title={data.title}
+  author={data.author}
+  description={data.desc}
+  isArticle={true}
+>
   <article>
     <h1>{data.title}</h1>
     <Content />
src/pages/about.astro
@@ -3,7 +3,7 @@ import Article from "@/contents/about.typ";
 import GlobalLayout from "@/layouts/GlobalLayout.astro";
 ---
 
-<GlobalLayout title="About">
+<GlobalLayout title="About" isArticle={true}>
   <article>
     <h1>About</h1>
     <Article />