feat: add custom slug validation and handling for posts

- Enhance content configuration with slug validation to ensure only valid characters are used
- Update post routing to support custom slugs with fallback to default slug
- Implement slug duplication check to prevent conflicts across different languages
- Modify various page components to use custom or default slugs in URL generation
This commit is contained in:
radishzzz 2025-01-25 03:14:52 +00:00
parent ee35006f7c
commit a26031d490
10 changed files with 67 additions and 11 deletions

View file

@ -13,7 +13,7 @@ const pinnedPosts = await getPinnedPosts()
<ul>
{pinnedPosts.map(post => (
<li>
<a href={`/posts/${post.slug}/`}>
<a href={`/posts/${post.data.slug || post.slug}/`}>
{post.data.title}
<time>({post.data.published.toISOString().split('T')[0]})</time>
</a>
@ -27,7 +27,7 @@ const pinnedPosts = await getPinnedPosts()
<ul>
{posts.map(post => (
<li>
<a href={`/posts/${post.slug}/`}>
<a href={`/posts/${post.data.slug || post.slug}/`}>
{post.data.title}
<time>({post.data.published.toISOString().split('T')[0]})</time>
</a>