mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
12 lines
378 B
TypeScript
12 lines
378 B
TypeScript
import { slug as slugger } from "github-slugger";
|
|
import type { BlogFrontmatter } from "@content/_schemas";
|
|
|
|
export const slugifyStr = (str: string) => slugger(str);
|
|
|
|
const slugify = (post: BlogFrontmatter) =>
|
|
post.postSlug ? slugger(post.postSlug) : slugger(post.title);
|
|
|
|
export const slufigyAll = (arr: string[]) => arr.map(str => slugifyStr(str));
|
|
|
|
export default slugify;
|