Compare commits

...

3 Commits

Author SHA1 Message Date
dc6c24e56a
Update Comments component to include inline Giscus script
All checks were successful
Test / test (push) Successful in 38s
Test / test (pull_request) Successful in 35s
2024-09-11 22:17:56 +00:00
6494405a04
Remove blog link from header component 2024-09-11 22:06:08 +00:00
c89ed0f7f9
Update default title and description 2024-09-11 22:03:55 +00:00
9 changed files with 31 additions and 16 deletions

2
.env Normal file
View File

@ -0,0 +1,2 @@
DEFAULT_TITLE=Valentin Popovs Technology Blog
DEFAULT_DESCRIPTION=Tech insights and coding best practices from an OpenSource enthusiast and ethical hacker.

View File

@ -14,7 +14,7 @@ const theme = "transparent_dark";
--- ---
<script <script
defer is:inline
src="https://giscus.app/client.js" src="https://giscus.app/client.js"
data-category-id={categoryId} data-category-id={categoryId}
data-category={category} data-category={category}
@ -28,5 +28,4 @@ const theme = "transparent_dark";
data-strict={strict} data-strict={strict}
data-theme={theme} data-theme={theme}
crossorigin={crossorigin} crossorigin={crossorigin}
> ></script>
</script>

View File

@ -1,17 +1,20 @@
--- ---
const canonicalURL = new URL(Astro.url.pathname, Astro.site); const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const { title, description } = Astro.props;
--- ---
<head> <head>
<meta content="IE=edge" http-equiv="X-UA-Compatible" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta content="index, follow" name="robots" /> <meta name="description" content={description ?? import.meta.env.DEFAULT_DESCRIPTION} />
<meta content="Description" name="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="/feed.xml" rel="alternate" title="RSS" type="application/atom+xml" />
<link href="/sitemap-index.xml" rel="sitemap" /> <link href="/sitemap-index.xml" rel="sitemap" />
<link href={canonicalURL} rel="canonical" /> <link href={canonicalURL} rel="canonical" />
<title>Title</title> <title>{title ?? import.meta.env.DEFAULT_TITLE}</title>
</head> </head>

View File

@ -5,7 +5,6 @@
<header> <header>
<nav> <nav>
<a href="/">Home</a> <a href="/">Home</a>
<a href="/blog/">Blog</a>
<span> <span>
<span>|</span> <span>|</span>
<a href="/feed.xml">RSS</a> <a href="/feed.xml">RSS</a>

8
src/env.d.ts vendored
View File

@ -1 +1,9 @@
/// <reference path="../.astro/types.d.ts" /> /// <reference path="../.astro/types.d.ts" />
interface ImportMetaEnv {
readonly DEFAULT_TITLE: string;
readonly DEFAULT_DESCRIPTION: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}

View File

@ -1,10 +1,12 @@
--- ---
import Head from "../components/Head.astro"; import Head from "../components/Head.astro";
import Header from "../components/Header.astro"; import Header from "../components/Header.astro";
const { title, description } = Astro.props;
--- ---
<html> <html lang="ru">
<Head /> <Head title={title} description={description} />
<body> <body>
<Header /> <Header />

View File

@ -1,7 +1,9 @@
--- ---
import BaseLayout from "./BaseLayout.astro"; import BaseLayout from "./BaseLayout.astro";
const { title, description } = Astro.props;
--- ---
<BaseLayout> <BaseLayout title={title} description={description}>
<slot /> <slot />
</BaseLayout> </BaseLayout>

View File

@ -22,7 +22,7 @@ const { Content, remarkPluginFrontmatter } = await post.render();
} }
</style> </style>
<Layout> <Layout title={post.data.title} description={post.data.description}>
<div class="header"> <div class="header">
<h1>{post.data.title}</h1> <h1>{post.data.title}</h1>
<p> <p>

View File

@ -6,7 +6,7 @@ export async function GET(context) {
return rss({ return rss({
customData: `<language>ru-ru</language>`, 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) => ({ items: posts.map((post) => ({
customData: post.data.customData, customData: post.data.customData,
description: post.data.description, description: post.data.description,
@ -15,6 +15,6 @@ export async function GET(context) {
title: post.data.title, title: post.data.title,
})), })),
site: context.site, site: context.site,
title: "Valentin Popovs Technology Blog", title: import.meta.env.DEFAULT_TITLE,
}); });
} }