AlchemyCMS / alchemy_cms

Alchemy is the Open Source Rails CMS framework for the component based web that can be used as classic server side rendered or headless CMS.
https://www.alchemy-cms.com
BSD 3-Clause "New" or "Revised" License
834 stars 313 forks source link

Handle Initial Integers in Ingredient type Headline DomId generation #3004

Open lassediercks opened 1 week ago

lassediercks commented 1 week ago

Is your feature request related to a problem? Please describe.

There is no technical implication, only a spec compliance issue.

According to the html spec id's must start with a letter. Given a Content Editor uses the Headline Ingredient to write something like: 1. How to photograph an elk the autogenerated domId would be 1-how-to-photograph-an-elk

howto.com/photo/guides#1-how-to-photograph-an-elk works though and also using an anchor link like

<a href="#1-how-to-photograph-an-elk#>Elk</a>

does work properly

Describe the solution you'd like

I'd expect alchemy Ingredient type Headline to convert integers to the word.

e.g. 1-how-to-photograph-an-elk would become one-how-to-photograph-an-elk

Describe alternatives you've considered

An alternative could be to just remove the integers from the domId

tvdeyen commented 1 week ago

For the sake of simplicity to fix this edge case I think removing leading numbers would be the best option here. Converting numbers to words would make it necessary to do it in a localization aware way. Because 1 is converted to one, eins, uno or une etc... dependent from the locale of the page.