From 4abfef69d328674f8ec14e3236b4618075c1ca4e Mon Sep 17 00:00:00 2001 From: grassblock Date: Thu, 1 May 2025 21:22:57 +0800 Subject: [PATCH] feat: change title path appearance --- src/config.ts | 4 ++++ src/layouts/Layout.astro | 7 ++++++- src/pages/blog.astro | 8 ++++---- src/pages/lab.astro | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 src/config.ts diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..dcfe039 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,4 @@ +export const siteConfig = { + title: '/var/log/mercury', + description: 'A blog about software development, technology, and life.', +} \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 714219e..942d01f 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -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 --- diff --git a/src/pages/blog.astro b/src/pages/blog.astro index da0a00f..2069217 100644 --- a/src/pages/blog.astro +++ b/src/pages/blog.astro @@ -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()); --- - +

~/blog

@@ -25,15 +25,15 @@ posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDat {posts.length === 0 && ( <>

- 2025-06-08 + 2025-06-08 My Terminal Setup

- 2025-06-05 + 2025-06-05 The Art of Minimalism

- 2025-06-01 + 2025-06-01 First Post

diff --git a/src/pages/lab.astro b/src/pages/lab.astro index 92e806f..6f66dea 100644 --- a/src/pages/lab.astro +++ b/src/pages/lab.astro @@ -2,7 +2,7 @@ import Layout from '../layouts/Layout.astro'; --- - +

~/lab