I have an issue where our urls aliases are based on the node title and our titles often contain dashes. Dashes are different from hyphens and come in two varieties, En Dashes and Em Dashes.
Because there is currently no way to ignore them in the Pathauto settings, I was getting urls like so:
Node Title:
Downloads – Install additional software
Pathauto URL alias:
http://www.root-of-site.com/software-requirements/downloads-–-install-additional-software
Notice that the En dash is surrounded by two hyphens here. Not a desirable result.
I have created a patch that adds both En and Em Dashes to the list of punctuation to be removed from urls in the settings. The resulting URL is this:
http://www.root-of-site.com/software-requirements/downloads-install-additional-software
Please consider rolling this into dev.
Comment | File | Size | Author |
---|---|---|---|
pathauto-add-dashes-to-punctuation-list.patch | 914 bytes | jaydee1818 | |
Comments
Comment #1
Toby Wild CreditAttribution: Toby Wild as a volunteer commentedFor those waiting for this to be included in the module, you could also include this using their hook into a custom module:
Also, in case anyone has the same issue I had, make sure your text editor is using UTF-8 encoding.
Notepad++ defaults to ANSI and it doesn't save the characters correctly.
Comment #2
dpovshed CreditAttribution: dpovshed as a volunteer and at Drupal Ukraine Community commented@jaydee1818, your patch working fine for me, so I am changing status of the issue.
However, for my task I will use hint from @Toby Wild to define even more characters. Those are loved by endusers in one project. So my hook looks like
Thanks to both of you!
Comment #3
Toby Wild CreditAttribution: Toby Wild at OPC IT commentedFantastic, can't wait to see this released.
Content authors love their special characters in page titles even though I keep telling them not to.
Comment #4
Dave ReidComment #5
KeithC CreditAttribution: KeithC as a volunteer and commentedHi,
This is causing issues (in particular with the Rate module) on a clients site.
Is this change likely to be included in a stable release any time soon?
Thanks
Comment #6
rdellis87 CreditAttribution: rdellis87 commentedThanks, jaydee1818. The patch appears to be working great for me.
Comment #7
whthat CreditAttribution: whthat at College of Western Idaho commentedAn alternative to not using this patch is using the Transliteration module then and turning on "Transliterate prior to creating alias" in /admin/config/search/path/settings and updating aliases for affect nodes has removed the em/en-dashes in titles along with apostrophe's and other unwanted characters.
Comment #8
zombree CreditAttribution: zombree as a volunteer commentedwhthat's tip is helpful for the D8 version of this module, but the "Transliterate prior to creating alias" option is not available in the D7 settings.
Comment #9
whthat CreditAttribution: whthat at College of Western Idaho commentedJust update the previous comment, you need the Transliteration module for that option in D7.