aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-09-12 01:03:55 +0300
committerValentin Popov <valentin@popov.link>2024-09-12 01:03:55 +0300
commitc89ed0f7f9dcf14d1d96ad0d13ad59f5b542396e (patch)
tree9c2a9ab17662a1b9c9539c9246b19b82f46d47f8 /src
parent97aa90a605602b9385ba734e2bd9d155aed954e8 (diff)
downloadpopov.link-c89ed0f7f9dcf14d1d96ad0d13ad59f5b542396e.tar.xz
popov.link-c89ed0f7f9dcf14d1d96ad0d13ad59f5b542396e.zip
Update default title and description
Diffstat (limited to 'src')
-rw-r--r--src/components/Comments.astro4
-rw-r--r--src/components/Head.astro15
-rw-r--r--src/env.d.ts8
-rw-r--r--src/layouts/BaseLayout.astro4
-rw-r--r--src/layouts/PageLayout.astro4
-rw-r--r--src/pages/blog/[...slug].astro2
-rw-r--r--src/pages/feed.xml.js4
7 files changed, 27 insertions, 14 deletions
diff --git a/src/components/Comments.astro b/src/components/Comments.astro
index 5fcd65d..f9ae4e5 100644
--- a/src/components/Comments.astro
+++ b/src/components/Comments.astro
@@ -14,7 +14,6 @@ const theme = "transparent_dark";
---
<script
- defer
src="https://giscus.app/client.js"
data-category-id={categoryId}
data-category={category}
@@ -28,5 +27,4 @@ const theme = "transparent_dark";
data-strict={strict}
data-theme={theme}
crossorigin={crossorigin}
->
-</script>
+></script>
diff --git a/src/components/Head.astro b/src/components/Head.astro
index bc5609f..42ae32b 100644
--- a/src/components/Head.astro
+++ b/src/components/Head.astro
@@ -1,17 +1,20 @@
---
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
+
+const { title, description } = Astro.props;
---
<head>
- <meta content="IE=edge" http-equiv="X-UA-Compatible" />
- <meta content="text/html; charset=utf-8" http-equiv="content-type" />
- <meta content="width=device-width, initial-scale=1" name="viewport" />
- <meta content="index, follow" name="robots" />
- <meta content="Description" name="description" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+
+ <meta name="description" content={description ?? import.meta.env.DEFAULT_DESCRIPTION} />
+ <meta name="robots" content="index, follow" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/feed.xml" rel="alternate" title="RSS" type="application/atom+xml" />
<link href="/sitemap-index.xml" rel="sitemap" />
<link href={canonicalURL} rel="canonical" />
- <title>Title</title>
+ <title>{title ?? import.meta.env.DEFAULT_TITLE}</title>
</head>
diff --git a/src/env.d.ts b/src/env.d.ts
index e16c13c..d714331 100644
--- a/src/env.d.ts
+++ b/src/env.d.ts
@@ -1 +1,9 @@
/// <reference path="../.astro/types.d.ts" />
+interface ImportMetaEnv {
+ readonly DEFAULT_TITLE: string;
+ readonly DEFAULT_DESCRIPTION: string;
+}
+
+interface ImportMeta {
+ readonly env: ImportMetaEnv;
+}
diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro
index 5a73ac6..5cbaf5c 100644
--- a/src/layouts/BaseLayout.astro
+++ b/src/layouts/BaseLayout.astro
@@ -1,10 +1,12 @@
---
import Head from "../components/Head.astro";
import Header from "../components/Header.astro";
+
+const { title, description } = Astro.props;
---
<html>
- <Head />
+ <Head title={title} description={description} />
<body>
<Header />
diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro
index 3730334..eff37fb 100644
--- a/src/layouts/PageLayout.astro
+++ b/src/layouts/PageLayout.astro
@@ -1,7 +1,9 @@
---
import BaseLayout from "./BaseLayout.astro";
+
+const { title, description } = Astro.props;
---
-<BaseLayout>
+<BaseLayout title={title} description={description}>
<slot />
</BaseLayout>
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
index 2593921..f99ef21 100644
--- a/src/pages/blog/[...slug].astro
+++ b/src/pages/blog/[...slug].astro
@@ -22,7 +22,7 @@ const { Content, remarkPluginFrontmatter } = await post.render();
}
</style>
-<Layout>
+<Layout title={post.data.title} description={post.data.description}>
<div class="header">
<h1>{post.data.title}</h1>
<p>
diff --git a/src/pages/feed.xml.js b/src/pages/feed.xml.js
index a509386..c837202 100644
--- a/src/pages/feed.xml.js
+++ b/src/pages/feed.xml.js
@@ -6,7 +6,7 @@ export async function GET(context) {
return rss({
customData: `<language>ru-ru</language>`,
- description: "Tech insights and coding best practices from an OpenSource enthusiast and ethical hacker.",
+ description: import.meta.env.DEFAULT_DESCRIPTION,
items: posts.map((post) => ({
customData: post.data.customData,
description: post.data.description,
@@ -15,6 +15,6 @@ export async function GET(context) {
title: post.data.title,
})),
site: context.site,
- title: "Valentin Popov’s Technology Blog",
+ title: import.meta.env.DEFAULT_TITLE,
});
}