console.log('Netlify build', process.env.CONTEXT)
}
+const rControl = /[\u0000-\u001f]/g
+const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g
+const rCombining = /[\u0300-\u036F]/g
+
+/**
+ * Default slugification function
+ */
+export const slugify = (str: string): string =>
+ str
+ .normalize('NFKD')
+ // Remove accents
+ .replace(rCombining, '')
+ // Remove control characters
+ .replace(rControl, '')
+ // Replace special characters
+ .replace(rSpecial, '-')
+ // ensure it doesn't start with a number
+ .replace(/^(\d)/, '_$1')
+
const productionHead: HeadConfig[] = [
[
'script',
},
anchor: {
- slugify: s => s.replace(/\s/g, '-'),
+ slugify,
},
},