Merge pull request #83 from Alaev/main

Small code simplification
This commit is contained in:
prototypa
2023-01-10 08:20:57 -05:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ const getNormalizedPost = async (post: CollectionEntry<'blog'>): Promise<Post> =
return {
id: id,
slug: cleanSlug(slug.split('/').pop() ?? ''),
slug: cleanSlug(slug.split('/').pop()),
publishDate: new Date(publishDate),
category: cleanSlug(category),

View File

@ -14,7 +14,7 @@ const createPath = (...params: string[]) => {
const BASE_PATHNAME = SITE.basePathname;
export const cleanSlug = (text: string) =>
export const cleanSlug = (text = '') =>
trimSlash(text)
.split('/')
.map((slug) => slugify(slug))