# \[SOLVED\] Tera encoding URL from variable

**URL:** <https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119>\
**Category:** Support\
**Created:** [May 30, 2019, 1:24am UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119 "2019-05-30T01:24:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![7596ff](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/7596ff/32/63_2.png) [@7596ff](https://zola.discourse.group/u/7596ff)\
**Post date:** [May 30, 2019, 1:24am UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119/1 "2019-05-30T01:24:39Z")

</div>

I’m trying to make a shortcode for a leaflet map with a GPX file displayed. I’m calling it like  
`{{ leaflet(id="map", gpx="/path/to/gpx") }}`.

In the shortcode, the variable `gpx` is referenced like this:  
`var gpx = "{{gpx}}";`

However, when the website compiles it shows up in public HTML as:  
`&#x2f;path&#x2f;to&#x2f;gpx`

I assume this is because Tera is URL Encoding the variable, but I don’t know why it would be doing that and I would like to know how to stop it from doing that.

Thanks!

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [May 30, 2019, 8:45am UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119/2 "2019-05-30T08:45:52Z")

</div>

Tera escapes _everything_, it doesn’t know that is it a URL. There is [https://github.com/Keats/tera/issues/368](https://github.com/Keats/tera/issues/368) to have a URL specific escaping scheme but not implemented yet.

You can do `var gpx = "{{gpx | safe}}";` in the meantime if you don’t let a user specify a URL.

---

<div class="post-metadata">

**Author:** ![7596ff](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/7596ff/32/63_2.png) [@7596ff](https://zola.discourse.group/u/7596ff)\
**Post date:** [May 30, 2019, 4:39pm UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119/3 "2019-05-30T16:39:20Z")

</div>

Yeah, it’s me linking to my own files on my own server. Thanks for the tip. Additionally, I would love to know how to debug my mess of Javascript code for my map shortcode. I’m having issues when I try to insert more than one map per page. I’ll post a gist with the errors I’m getting and the code I’m using.

> <https://gist.github.com/7596ff/5f1e0fe4c23134d568ee8ac4badb601d>

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [May 30, 2019, 5:49pm UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119/4 "2019-05-30T17:49:14Z")

</div>

Try to `console.log(e.target.getBounds())`, it’s probably not valid latlng bounds - eg could be undefined

---

<div class="post-metadata">

**Author:** ![7596ff](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/7596ff/32/63_2.png) [@7596ff](https://zola.discourse.group/u/7596ff)\
**Post date:** [May 30, 2019, 7:04pm UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119/5 "2019-05-30T19:04:56Z")

</div>

It’s just an empty bounds object. I’m going to give a different library a try.

---

<div class="post-metadata">

**Author:** ![7596ff](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/7596ff/32/63_2.png) [@7596ff](https://zola.discourse.group/u/7596ff)\
**Post date:** [May 30, 2019, 7:39pm UTC](https://zola.discourse.group/t/solved-tera-encoding-url-from-variable/119/6 "2019-05-30T19:39:07Z")

</div>

I tried a different library and it worked fine. Thanks for giving my code a look.
