Closed ThePeach closed 1 year ago
In the slug
module, you can get the desired behavior by assigning the mapping directly to the charmap
property.
slug.charmap['/'] = '-';
slugify
doesn't have the charmap
property and trying to get this to work with extend()
didn't work for me if I did it the straightforward way. I suspect this may have something to do with slugify
automatically removing certain characters. I'd have to dig in more to see if there is a convenient way to override things. @simov might have the answer.
I just wanted to post the same question (to have more readable results for slugified paths) but then I found out you can use extend()
for this:
import slugify from 'slugify'
slugify.extend({'/': '-'})
console.log( slugify('https://github.com/simov/slugify/issues/161') )
// Result: https:-github.com-simov-slugify-issues-161
Well, if that works, then great. I don't know why I couldn't get it to work before, but happy to be wrong.
Hello, I'm currently working with 11ty and migrating to the latest version. I've stumbled on a single instance where I can't seem to adjust the resulting permalink to the previous version. Specifically I have a tag that is "Gnu/Linux" that gets converted into "gnulinux" while before I had "gnu-linux". Is there any way to customise this behaviour?