Closed hikerpig closed 1 year ago
From gatsby-theme-kb@0.9.2 , you can customise the slugifyFn
during page creation.
I use this in my own wiki.
gatsby-config.js
function mySlugify(str) {
if (!str) return str
let out = str.trim().replace(/\s+/g, '-')
return out
}
module.exports = {
// ...
plugins: [
{
resolve: 'gatsby-theme-kb',
options: {
// ...
slugifyFn: mySlugify,
},
},
],
}
Up to gatsby-theme-kb@0.9.2 , I use
slugify(fileName)
to generate url slug.But this function will not keep most of the utf-8 characters. For example
认知.md
will be an empty string, makes navigation imposibble.