mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 03:56:19 +02:00
refactor: optimize multilingual article routing logic, modify slug to abbrlink
This commit is contained in:
parent
16491dae50
commit
e5165dd740
16 changed files with 673 additions and 133 deletions
|
@ -14,9 +14,9 @@ const postsCollection = defineCollection({
|
|||
toc: z.boolean().optional().default(false),
|
||||
draft: z.boolean().optional().default(false),
|
||||
lang: z.string().optional().default(''),
|
||||
slug: z.string().optional().default('').refine(
|
||||
slug => !slug || /^[\w\-]*$/.test(slug),
|
||||
{ message: 'Slug can only contain letters, numbers, hyphens and underscores' },
|
||||
abbrlink: z.string().optional().default('').refine(
|
||||
abbrlink => !abbrlink || /^[a-z0-9\-]*$/.test(abbrlink),
|
||||
{ message: 'Abbrlink can only contain letters, numbers, hyphens and underscores' },
|
||||
),
|
||||
minutes: z.number().optional(),
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue