portfolio/lib/createSlug.ts

6 lines
166 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:59:44 +00:00
.replace(/\'/g, '')
2024-09-18 16:36:21 +00:00
.replace(/\?/g, '')
.replace(/[.,\s]+/g, '-')
2023-01-17 21:24:16 +00:00
}