mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 19:22:52 +02:00
39 lines
1.2 KiB
Text
39 lines
1.2 KiB
Text
---
|
|
import Waline from '@/components/Comments/Waline.astro'
|
|
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() {
|
|
const posts = await getCollection('posts')
|
|
|
|
const duplicates = await checkSlugDuplication(posts)
|
|
if (duplicates.length > 0) {
|
|
throw new Error(`Slug conflicts found:\n${duplicates.join('\n')}`)
|
|
}
|
|
|
|
return generateMultiLangPostPaths(posts)
|
|
}
|
|
|
|
const { post } = Astro.props
|
|
const description = generateDescription(post)
|
|
const { Content, remarkPluginFrontmatter } = await post.render()
|
|
---
|
|
|
|
<Layout
|
|
postTitle={post.data.title}
|
|
postDescription={description}
|
|
postSlug={post.slug}
|
|
>
|
|
<article>
|
|
<h1>{post.data.title}</h1>
|
|
<time>
|
|
{post.data.published.toLocaleDateString('en-US', { month: '2-digit', day: '2-digit' }).replace('/', '-')}
|
|
{remarkPluginFrontmatter.minutes && <span> {remarkPluginFrontmatter.minutes} min</span>}
|
|
</time>
|
|
<Content />
|
|
</article>
|
|
<Waline />
|
|
</Layout>
|