feat: enhance post listing and reading time display

- Implement dynamic post listing grouped by year with improved date formatting
- Add reading time display for each post
- Update index pages for both default and localized routes
- Modify content utility functions to support reading time metadata
- Refactor global styles and type definitions to support new features
This commit is contained in:
radishzzz 2025-01-26 02:59:39 +00:00
parent e9e318e02d
commit ae39d7b08c
18 changed files with 558 additions and 117 deletions

View file

@ -16,7 +16,7 @@ export async function getStaticPaths() {
}
const { post } = Astro.props
const { Content } = await post.render()
const { Content, remarkPluginFrontmatter } = await post.render()
---
<Layout
@ -26,7 +26,10 @@ const { Content } = await post.render()
>
<article>
<h1>{post.data.title}</h1>
<time>{post.data.published.toISOString().split('T')[0]}</time>
<time>
{post.data.published.toLocaleDateString('en-US', { month: '2-digit', day: '2-digit' }).replace('/', '-')}
{remarkPluginFrontmatter.minutes && <span> · {remarkPluginFrontmatter.minutes} min</span>}
</time>
<Content />
</article>
</Layout>