feat: implement SEO enhancements, automatic slug generation, and font optimizations
All checks were successful
Build and Push App / build (push) Successful in 9m12s
All checks were successful
Build and Push App / build (push) Successful in 9m12s
This commit is contained in:
13
lib/utils.ts
Normal file
13
lib/utils.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
export function generateSlug(text: string): string {
|
||||
return text
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.normalize('NFD') // remove accents
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.replace(/\s+/g, '-') // replace spaces with -
|
||||
.replace(/[^\w-]+/g, '') // remove all non-word chars
|
||||
.replace(/--+/g, '-') // replace multiple - with single -
|
||||
.replace(/^-+/, '') // trim - from start of text
|
||||
.replace(/-+$/, ''); // trim - from end of text
|
||||
}
|
||||
Reference in New Issue
Block a user