Commit 129e7da

HPCesia <me@hpcesia.com>
2026-02-09 17:13:53
Add more metadata for each pages
1 parent bdef309
Changed files (5)
src/layouts/GlobalLayout.astro
@@ -5,9 +5,15 @@ import { SITE_CONFIG } from "@/config";
 
 interface Props {
   title?: string;
+  author?: string;
+  description?: string;
 }
 
-const { title = SITE_CONFIG.title } = Astro.props;
+const {
+  title = SITE_CONFIG.title,
+  author = SITE_CONFIG.author,
+  description = SITE_CONFIG.description,
+} = Astro.props;
 ---
 
 <html lang="en">
@@ -20,6 +26,15 @@ const { title = SITE_CONFIG.title } = Astro.props;
     <link rel="icon" href="/favicon.ico" />
 
     <title>{title}</title>
+    <meta name="title" content={title} />
+    <meta name="description" content={description} />
+    <meta name="author" content={author} />
+
+    <meta property="og:title" content={title} />
+    <meta property="og:description" content={description} />
+
+    <meta property="twitter:title" content={title} />
+    <meta property="twitter:description" content={description} />
   </head>
   <body class="mx-auto px-4 max-w-268 font-serif">
     <Header />
src/pages/posts/[slug].astro
@@ -20,7 +20,7 @@ const data = entry.data;
 const { Content } = await render(entry);
 ---
 
-<GlobalLayout title={data.title}>
+<GlobalLayout title={data.title} author={data.author} description={data.desc}>
   <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>
+<GlobalLayout title="About">
   <article>
     <h1>About</h1>
     <Article />
src/types/config.d.ts
@@ -7,4 +7,12 @@ export type SiteConfig = {
    * Title of your website.
    */
   title: string;
+  /**
+   * Main author of your website.
+   */
+  author: string;
+  /**
+   * Description of you website.
+   */
+  description: string;
 };
src/config.ts
@@ -3,4 +3,7 @@ import type { SiteConfig } from "@/types/config.d.ts";
 export const SITE_CONFIG: SiteConfig = {
   website: "https://example.com/",
   title: "Tybios",
+  author: "HPCesia",
+  description:
+    "A Tufted style static blog template built with Astro and Typst.",
 };