Skip to content

Commit efdf418

Browse files
authored
Merge pull request #83 from Alaev/main
Small code simplification
2 parents f641767 + e90714b commit efdf418

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/utils/blog.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const getNormalizedPost = async (post: CollectionEntry<'blog'>): Promise<Post> =
1111

1212
return {
1313
id: id,
14-
slug: cleanSlug(slug.split('/').pop() ?? ''),
14+
slug: cleanSlug(slug.split('/').pop()),
1515

1616
publishDate: new Date(publishDate),
1717
category: cleanSlug(category),

src/utils/permalinks.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const createPath = (...params: string[]) => {
1414

1515
const BASE_PATHNAME = SITE.basePathname;
1616

17-
export const cleanSlug = (text: string) =>
17+
export const cleanSlug = (text = '') =>
1818
trimSlash(text)
1919
.split('/')
2020
.map((slug) => slugify(slug))

0 commit comments

Comments
 (0)