- Issue created by @phonkala
- 🇫🇷France mably
Hi @phonkala, happy to hear that you find toc_ng interesting.
Would you mind explaining more in details what the problem is exactly?
I'm not sure to understand what is wrong with a trailing hyphen in the URL hashes, if I understand it correctly.
- 🇫🇮Finland phonkala
Hey there!
There is nothing wrong with it technically, but I don't think it really should be there. I guess same would apply if hyphen was the first character in the url. Sure it works fine, but for readability/cleanliness in for example search results etc, it just feels very unnecessary.
For example, if there was a header:
"!!! Hey this works fine, don't you think???",I don't think the url should be
"mydomain.com/article-1#-hey-this-works-fine-dont-you-think-", it should be
"mydomain.com/article-1#hey-this-works-fine-dont-you-think"But I guess in the end it's just my opinion. Though I do truely think that when applying this kind of automation, the goal should be as simple and easy-to-read urls as possible, and those first/last character hyphens really have no reason to be in the URL, at least I can't think of a any :)
- Assigned to mably
- Status changed to Fixed
8 months ago 4:55pm 27 June 2024 - 🇫🇷France mably
Just pushed a small fix to the dev branch that trims those extra hyphens.
You can give it a try and tell me how it goes.
- 🇫🇮Finland phonkala
Thanks, this seems to work nicely. All the anchor URLs look very clear and pretty now.
I also realized that certain characters that should just be removed from the urls (like apostrophe, quotation mark etc) are currently turned into hyphens. So I was thinking: Would it be possible to just use the Drupal cores transliteration interface to achieve this (Drupal\Component\Transliteration)? This is of course just an idea, but I guess that would streamline the module with Drupals behavior even more.
Anyways, the current dev version works perfectly for my use, thanks for the latest update!
- 🇫🇷France mably
Headings parsing is done client-side in Javascript, so we do not have access to Drupal API.
Automatically closed - issue fixed for 2 weeks with no activity.
- Issue was unassigned.