portfolio/lib/createSlug.ts

5 lines
143 B
TypeScript
Raw Normal View History

2023-01-17 21:24:16 +00:00
export function createSlug(title: string) {
2024-09-18 16:36:21 +00:00
return title.toLowerCase()
2024-09-23 14:36:11 +00:00
.replace(/[\'\?]+/g, '')
2024-09-18 16:36:21 +00:00
.replace(/[.,\s]+/g, '-')
2023-01-17 21:24:16 +00:00
}