From 96223c0b5a4f7ed8eb88bfb876e85af58cf9ebad Mon Sep 17 00:00:00 2001 From: saicaca Date: Sun, 21 Jul 2024 18:41:03 +0800 Subject: [PATCH] refactor: improve code quality --- src/components/Navbar.astro | 18 ++++++------ src/components/PostCard.astro | 4 +-- src/components/control/BackToTop.astro | 2 +- src/components/control/Pagination.astro | 4 +-- src/components/misc/License.astro | 2 +- src/components/widget/NavMenuPanel.astro | 4 +-- src/components/widget/Profile.astro | 4 +-- src/components/widget/WidgetLayout.astro | 2 +- src/layouts/Layout.astro | 32 ++++----------------- src/layouts/MainGridLayout.astro | 8 +++--- src/pages/[...page].astro | 8 +++--- src/pages/archive/category/[category].astro | 2 +- src/pages/archive/index.astro | 1 - src/pages/posts/[...slug].astro | 6 ++-- src/pages/rss.xml.ts | 1 - 15 files changed, 38 insertions(+), 60 deletions(-) diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 90f70d7..cbac9fe 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -23,7 +23,7 @@ let links: NavBarLink[] = navBarConfig.links.map((item: NavBarLink | LinkPreset) "card-base sticky top-0 overflow-visible max-w-[var(--page-width)] h-[4.5rem] rounded-t-none mx-auto flex items-center justify-between px-4"]}>
- + {siteConfig.title}
@@ -34,7 +34,7 @@ let links: NavBarLink[] = navBarConfig.links.map((item: NavBarLink | LinkPreset) >
{l.name} - {l.external && } + {l.external && }
; })} @@ -42,24 +42,24 @@ let links: NavBarLink[] = navBarConfig.links.map((item: NavBarLink | LinkPreset)
- - - - + + + + {!siteConfig.themeColor.fixed && ( )}
- + diff --git a/src/components/PostCard.astro b/src/components/PostCard.astro index 44ab3c8..14002a7 100644 --- a/src/components/PostCard.astro +++ b/src/components/PostCard.astro @@ -40,8 +40,8 @@ const { remarkPluginFrontmatter } = await entry.render(); before:absolute before:top-[35px] before:left-[18px] before:hidden md:before:block "> {title} - - + + diff --git a/src/components/control/BackToTop.astro b/src/components/control/BackToTop.astro index 2929472..6f84523 100644 --- a/src/components/control/BackToTop.astro +++ b/src/components/control/BackToTop.astro @@ -40,7 +40,7 @@ import { Icon } from 'astro-icon/components'; - +
{entry.data.nextSlug &&
- +
{entry.data.nextTitle}
@@ -124,7 +124,7 @@ const jsonLd = {
{entry.data.prevTitle}
- +
}
diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index ef37031..4374cd1 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -1,6 +1,5 @@ import rss from '@astrojs/rss'; import {siteConfig} from '@/config'; -import { getCollection } from 'astro:content'; import sanitizeHtml from 'sanitize-html'; import MarkdownIt from 'markdown-it'; import {getSortedPosts} from "@utils/content-utils.ts";