mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 12:01:33 +02:00
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:
parent
ee35006f7c
commit
a26031d490
10 changed files with 67 additions and 11 deletions
|
@ -21,7 +21,7 @@ const posts = await getPosts()
|
|||
<ul>
|
||||
{pinnedPosts.map(post => (
|
||||
<li>
|
||||
<a href={`/${lang}/posts/${post.slug}/`}>
|
||||
<a href={`/${lang}/posts/${post.data.slug || post.slug}/`}>
|
||||
{post.data.title}
|
||||
<time>({post.data.published.toISOString().split('T')[0]})</time>
|
||||
</a>
|
||||
|
@ -35,7 +35,7 @@ const posts = await getPosts()
|
|||
<ul>
|
||||
{posts.map(post => (
|
||||
<li>
|
||||
<a href={`/${lang}/posts/${post.slug}/`}>
|
||||
<a href={`/${lang}/posts/${post.data.slug || post.slug}/`}>
|
||||
{post.data.title}
|
||||
<time>({post.data.published.toISOString().split('T')[0]})</time>
|
||||
</a>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue