mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
Slugify not only frontmatter.title but also frontmatter.slug
This commit is contained in:
@@ -6,7 +6,7 @@ const slugger = GithubSlugger.slug;
|
|||||||
export const slugifyStr = (str: string) => slugger(str);
|
export const slugifyStr = (str: string) => slugger(str);
|
||||||
|
|
||||||
const slugify = (frontmatter: Frontmatter) =>
|
const slugify = (frontmatter: Frontmatter) =>
|
||||||
frontmatter.slug ? frontmatter.slug : slugger(frontmatter.title);
|
frontmatter.slug ? slugger(frontmatter.slug) : slugger(frontmatter.title);
|
||||||
|
|
||||||
export const slufigyAll = (arr: string[]) => arr.map((str) => slugifyStr(str));
|
export const slufigyAll = (arr: string[]) => arr.map((str) => slugifyStr(str));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user