update: unified multilingual page styles

This commit is contained in:
radishzzz 2025-03-14 05:20:59 +00:00
parent 05d3a8034b
commit 91d27dd2ba
14 changed files with 118 additions and 85 deletions

View file

@ -1,5 +1,6 @@
---
import themeConfig from '@/config'
import { allLocales, defaultLocale } from '@/i18n/config'
import { ClientRouter } from 'astro:transitions'
interface Props {
@ -12,7 +13,7 @@ const { postTitle, postDescription, postSlug } = Astro.props
const { title, subtitle, description, author, url, favicon } = themeConfig.site
const { mode, light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color
const { locale, moreLocale } = themeConfig.global
// const { locale, moreLocales } = themeConfig.global
const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '' } = themeConfig.seo ?? {}
const { google = '', bing = '', yandex = '', baidu = '' } = verification
const { commentURL = '', imageHostURL = '', customGoogleAnalyticsJS = '', customUmamiAnalyticsJS = '' } = themeConfig.preload
@ -48,10 +49,10 @@ const pageImage = postSlug ? `${url}/og/${postSlug}.png` : 'https://placehold.co
<link rel="canonical" href={Astro.url} />
<!-- i18n hreflang generate -->
{[locale, ...moreLocale].map(lang => (
{allLocales.map(lang => (
<link
rel="alternate"
href={`${url}${lang === locale ? '' : `/${lang}/`}`}
href={`${url}${lang === defaultLocale ? '' : `/${lang}/`}`}
hreflang={lang === 'zh-tw' ? 'zh-TW' : lang}
/>
))}