mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 12:01:33 +02:00
🚀 refactor: unify page routing files
This commit is contained in:
parent
d352b6fb65
commit
54902da6dd
19 changed files with 522 additions and 348 deletions
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
import PostList from '@/components/PostList.astro'
|
||||
import { getMultiLangRoutes } from '@/i18n/route'
|
||||
import Layout from '@/layouts/Layout.astro'
|
||||
import { getPinnedPosts, getPostsByYear } from '@/utils/content'
|
||||
|
||||
export function getStaticPaths() {
|
||||
return getMultiLangRoutes()
|
||||
}
|
||||
|
||||
const { lang } = Astro.params
|
||||
const pinnedPosts = await getPinnedPosts(lang)
|
||||
const postsByYear = await getPostsByYear(lang)
|
||||
---
|
||||
|
||||
<Layout>
|
||||
<main>
|
||||
<!-- Pinned Posts -->
|
||||
{pinnedPosts.length > 0 && (
|
||||
<section class="mb-7.5">
|
||||
<div class="uno-decorative-line"></div>
|
||||
<PostList posts={pinnedPosts} lang={lang} />
|
||||
</section>
|
||||
)}
|
||||
<!-- Regular Posts -->
|
||||
{[...postsByYear.entries()].map(([_year, posts]) => (
|
||||
<section class="mb-7.5">
|
||||
<div class="uno-decorative-line"></div>
|
||||
<PostList posts={posts} lang={lang} />
|
||||
</section>
|
||||
))}
|
||||
</main>
|
||||
</Layout>
|
Loading…
Add table
Add a link
Reference in a new issue