# How to replace %20 by "-" in a url created from a dynamic collection

**URL:** <https://community.weweb.io/t/how-to-replace-20-by-in-a-url-created-from-a-dynamic-collection/13927>\
**Category:** Ask us anything\
**Created:** [October 15, 2024, 10:47am UTC](https://community.weweb.io/t/how-to-replace-20-by-in-a-url-created-from-a-dynamic-collection/13927 "2024-10-15T10:47:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![antony](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@antony](https://community.weweb.io/u/antony)\
**Post date:** [October 15, 2024, 10:47am UTC](https://community.weweb.io/t/how-to-replace-20-by-in-a-url-created-from-a-dynamic-collection/13927/1 "2024-10-15T10:47:59Z")

</div>

Is it only in preview mode ?

I would like to replace these %20 between the spaces. But as the url is created dynamically I don’t know how and where to change this.  
And I want the user to be able to reach the url just by writing it

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [October 15, 2024, 10:57am UTC](https://community.weweb.io/t/how-to-replace-20-by-in-a-url-created-from-a-dynamic-collection/13927/2 "2024-10-15T10:57:44Z")

</div>

Hi @antony 👋

You can create a “slugify” formula so that spaces (represented by %20) are replaced by `-`

 ![CleanShot 2024-10-15 at 12.55.17@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/6781082b41d9415c665a9a12de2c80490a929663.png)

In the example above, you can see that:

- we are using the `lowercase` nocode formula to ensure all the text is lowercased
- we are using a short JavaScript function at the end of the text `.replaceAll()`
- in that function, we are saying replace spaces `" "` by dashes `"-"`
- in the `Current value` the text is formatted as a slug

Does that help?

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [October 15, 2024, 11:00am UTC](https://community.weweb.io/t/how-to-replace-20-by-in-a-url-created-from-a-dynamic-collection/13927/3 "2024-10-15T11:00:43Z")

</div>

Note, if you want to reuse this formula in different places of your project, you could create a global formula with a text parameter:

 ![CleanShot 2024-10-15 at 12.58.07@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/9/9d00feca221c6ae000025b8d184fd3af9cbd7506.png)

Then you could use that custom formula anywhere in your project:

 ![CleanShot 2024-10-15 at 13.00.00@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/5759fcf2a97ee503c6bcdec45c4bf612dda3cfc4.png)

---

<div class="post-metadata">

**Author:** ![antony](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@antony](https://community.weweb.io/u/antony)\
**Post date:** [October 15, 2024, 2:15pm UTC](https://community.weweb.io/t/how-to-replace-20-by-in-a-url-created-from-a-dynamic-collection/13927/4 "2024-10-15T14:15:18Z")

</div>

Hi Joyce !  
Thank you ! 🙂 🤩
