Commit aec3285

HPCesia <me@hpcesia.com>
2026-01-31 05:47:56
Extract global layout
1 parent 0830c88
Changed files (2)
src/layouts/GlobalLayout.astro
@@ -0,0 +1,25 @@
+---
+import "@/styles/global.css";
+
+interface Props {
+  title: string;
+}
+
+const { title } = Astro.props;
+---
+
+<html lang="en">
+  <head>
+    <meta charset="utf-8" />
+    <meta name="viewport" content="width=device-width" />
+    <meta name="generator" content={Astro.generator} />
+
+    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+    <link rel="icon" href="/favicon.ico" />
+
+    <title>{title}</title>
+  </head>
+  <body>
+    <slot />
+  </body>
+</html>
src/pages/index.astro
@@ -1,17 +1,7 @@
 ---
-import "@/styles/global.css";
+import GlobalLayout from "@/layouts/GlobalLayout.astro";
 ---
 
-<html lang="en">
-  <head>
-    <meta charset="utf-8" />
-    <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
-    <link rel="icon" href="/favicon.ico" />
-    <meta name="viewport" content="width=device-width" />
-    <meta name="generator" content={Astro.generator} />
-    <title>Astro</title>
-  </head>
-  <body>
-    <h1>Astro</h1>
-  </body>
-</html>
+<GlobalLayout title="Astro">
+  <h1>Astro</h1>
+</GlobalLayout>