From f5526f86225684f346ecfff264cde919a650fdb3 Mon Sep 17 00:00:00 2001 From: radishzzz Date: Fri, 14 Mar 2025 14:23:35 +0000 Subject: [PATCH] refactor: rename functions --- src/components/Comments/Waline.astro | 10 +++------- src/components/MainHeader.astro | 5 ++--- src/components/MobileHeader.astro | 5 ++--- src/components/Navbar.astro | 5 ++--- src/components/PostTime.astro | 3 +-- src/i18n/path.ts | 7 ++++++- src/i18n/route.ts | 20 ++++++++++---------- src/layouts/Layout.astro | 4 ++-- src/pages/[lang]/about.astro | 4 ++-- src/pages/[lang]/atom.xml.ts | 4 ++-- src/pages/[lang]/index.astro | 4 ++-- src/pages/[lang]/posts/[slug].astro | 4 ++-- src/pages/[lang]/rss.xml.ts | 4 ++-- src/pages/[lang]/tags/[tag].astro | 4 ++-- src/pages/[lang]/tags/index.astro | 4 ++-- src/pages/posts/[slug].astro | 4 ++-- src/pages/tags/[tag].astro | 4 ++-- 17 files changed, 46 insertions(+), 49 deletions(-) diff --git a/src/components/Comments/Waline.astro b/src/components/Comments/Waline.astro index 564aa8f..8314bd7 100644 --- a/src/components/Comments/Waline.astro +++ b/src/components/Comments/Waline.astro @@ -17,9 +17,6 @@ const { imageUploader = false, } = themeConfig.comment?.waline ?? {} -// Get current path -const currentPath = Astro.url.pathname - // Get the language code of Waline function getWalineLang(currentPath: string, defaultLocale: string): string { // Extract language code from path @@ -32,7 +29,7 @@ function getWalineLang(currentPath: string, defaultLocale: string): string { } // Get Waline language and generate configuration -const walineLang = getWalineLang(currentPath, defaultLocale) +const walineLang = getWalineLang(Astro.url.pathname, defaultLocale) const walineConfigJson = JSON.stringify({ serverURL, lang: walineLang, @@ -49,8 +46,7 @@ const walineConfigJson = JSON.stringify({ > - - + - +