feat: change title path appearance

This commit is contained in:
grassblock 2025-05-01 21:22:57 +08:00
parent 534abd91e3
commit 4abfef69d3
4 changed files with 15 additions and 6 deletions

4
src/config.ts Normal file
View file

@ -0,0 +1,4 @@
export const siteConfig = {
title: '/var/log/mercury',
description: 'A blog about software development, technology, and life.',
}

View file

@ -2,13 +2,18 @@
import '../styles/global.css';
import Search from '../components/Search.astro';
import ThemeSwitcher from '../components/ThemeSwitcher.astro';
import { siteConfig } from "../config";
interface Props {
title: string;
path?: string;
}
const { title, path = "~/grassblock/micr0blog" } = Astro.props;
const defaultTitle = siteConfig.title
const formattedPath = defaultTitle.toLowerCase().replace(/\s+/g, '-');
const { title, path = formattedPath } = Astro.props;
// TODO: make the path dynamic
---
<!doctype html>

View file

@ -6,7 +6,7 @@ const posts = await getCollection('blog');
posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
---
<Layout title="Blog | Terminal Blog" path="~/grassblock/micr0blog/blog">
<Layout title="Blog | Terminal Blog">
<h1 class="post-title">~/blog</h1>
<div class="post-content">
@ -25,15 +25,15 @@ posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDat
{posts.length === 0 && (
<>
<p>
<span style="color: var(--terminal-yellow);">2025-06-08</span>
<span style="color: var(--terminal-yellow);">2025-06-08</span>
<a href="/blog/terminal-setup">My Terminal Setup</a>
</p>
<p>
<span style="color: var(--terminal-yellow);">2025-06-05</span>
<span style="color: var(--terminal-yellow);">2025-06-05</span>
<a href="/blog/minimalism">The Art of Minimalism</a>
</p>
<p>
<span style="color: var(--terminal-yellow);">2025-06-01</span>
<span style="color: var(--terminal-yellow);">2025-06-01</span>
<a href="/blog/first-post">First Post</a>
</p>
</>

View file

@ -2,7 +2,7 @@
import Layout from '../layouts/Layout.astro';
---
<Layout title="Lab | Terminal Blog" path="~/grassblock/micr0blog/lab">
<Layout title="Lab | Terminal Blog" >
<h1 class="post-title">~/lab</h1>
<div class="post-content">