feat: complete language switching functionality and centralized page routing

This commit is contained in:
radishzzz 2025-03-14 03:30:56 +00:00
parent 4651828dd1
commit 05d3a8034b
26 changed files with 253 additions and 146 deletions

View file

@ -1,9 +1,9 @@
---
import Waline from '@/components/Comments/Waline.astro'
import { generateMultiLangPostPaths } from '@/i18n/route'
import Layout from '@/layouts/Layout.astro'
import { checkSlugDuplication } from '@/utils/content'
import { generateDescription } from '@/utils/description'
import { generateMultiLangPostPaths } from '@/utils/i18n/route'
import { getCollection } from 'astro:content'
export async function getStaticPaths() {
@ -17,7 +17,7 @@ export async function getStaticPaths() {
return generateMultiLangPostPaths(posts)
}
const { post } = Astro.props
const { post, supportedLangs = [] } = Astro.props
const description = generateDescription(post)
const { Content, remarkPluginFrontmatter } = await post.render()
---
@ -26,6 +26,7 @@ const { Content, remarkPluginFrontmatter } = await post.render()
postTitle={post.data.title}
postDescription={description}
postSlug={post.slug}
supportedLangs={supportedLangs}
>
<article>
<h1>{post.data.title}</h1>