×
Orchidbox
← Technical

JavaScript Function To Generate URLs Without Any Rubbish Characters

[ Published September 20, 2018 ]

We couldn’t find any free function available, for this reason our Sergey built a collection of amazing JS functions for Orchid box CMS. We have decided to release it to the world so no other developer should struggle as we did.

–          Strip of any non alphanumeric characters

–          Space converted to _

–          Not more than one _ between alphanumeric characters

–          JS function can be invoked on focus, hence very fast

The function : GenerateUrl  would transform :

E.g. 1

source: this is my title

result: this_is_my_title

E.g. 2

Source: This is my n.1 post, really ? Should I have written more          , or     less    ?

Result: This_is_my_n_1_post_really_Should_I_have_written_more_or_less

E.g. 3

Source: rubbish characters : &^%&^%&%*^(**&^%”£%”££^%$&^%^& (I am not rubbish)

Result: rubbish_characters_I_am_not_rubbish

Usage example:

Happy amazing URLs !

… and if you want to know more about our amazing CMS please get in touch.

You may also like...

Let's Talk