Commit 9b22328
Changed files (4)
src
src/layouts/BaseLayout.astro
@@ -1,12 +1,19 @@
---
import "sanitize.css/sanitize.css";
import "@/styles/global.scss";
+import { SITE_CONFIG } from "@/config";
interface Props {
title?: string;
+ author?: string;
+ description?: string;
}
-const { title = "Kerplunk" } = Astro.props;
+const {
+ title = SITE_CONFIG.title,
+ author = SITE_CONFIG.author,
+ description = SITE_CONFIG.description,
+} = Astro.props;
---
<!doctype html>
<html lang="en">
@@ -20,6 +27,8 @@ const { title = "Kerplunk" } = Astro.props;
<title>{title}</title>
<meta name="title" content={title} />
+ <meta name="description" content={description} />
+ <meta name="author" content={author} />
</head>
<body>
<slot />
src/types/config.d.ts
@@ -0,0 +1,18 @@
+export type SiteConfig = {
+ /**
+ * A URL where this website deployed.
+ */
+ website: `${string}://${string}`;
+ /**
+ * Title of this website.
+ */
+ title: string;
+ /**
+ * Main author of this website.
+ */
+ author: string;
+ /**
+ * Description of this website.
+ */
+ description: string;
+};
src/config.ts
@@ -0,0 +1,8 @@
+import type { SiteConfig } from "@/types/config.d.ts";
+
+export const SITE_CONFIG: SiteConfig = {
+ website: "https://example.com",
+ title: "Kerplunk",
+ author: "John Doe",
+ description: "A static blog template.",
+};
astro.config.ts
@@ -1,4 +1,12 @@
import { defineConfig } from "astro/config";
+import { SITE_CONFIG } from "./src/config.ts";
+
+const protocol = SITE_CONFIG.website.split("://")[0];
+const site = SITE_CONFIG.website.split("://")[1].split("/")[0];
+const base = SITE_CONFIG.website.split(site).slice(1).join("/") || undefined;
// https://astro.build/config
-export default defineConfig({});
+export default defineConfig({
+ site: `${protocol}://${site}`,
+ base: base,
+});