I’m trying to write a shortcode for the Komoot website but I’m having some problems with the passing of the query parameters. The shortcode implementation is
<!-- reset scratch variables at the start -->
{{- $.Scratch.Set "k_id" false -}}
{{- $.Scratch.Set "k_profile" false -}}
{{- $.Scratch.Set "k_gallery" false -}}
{{- $.Scratch.Set "k_height" 580 -}}
{{- if .IsNamedParams -}}
{{- $.Scratch.Set "k_id" (.Get "id") -}}
{{- $.Scratch.Set "k_profile" (.Get "profile") -}}
{{- $.Scratch.Set "k_gallery" (.Get "gallery") -}}
{{- else -}}
<!-- for the positional version if any -->
{{- end -}}
{{- $.Scratch.Set "queries" slice -}}
{{- if $.Scratch.Get "k_profile" -}}
{{- $.Scratch.Add "queries" (querify "profile" 1) -}}
{{- $.Scratch.Set "k_height" 680 -}}
{{- end -}}
{{- if $.Scratch.Get "k_gallery" -}}
{{- $.Scratch.Add "queries" (querify "gallery" 1) -}}
{{- end -}}
<iframe src="https://www.komoot.nl/tour/{{- $.Scratch.Get "k_id" -}}/embed?{{ delimit ($.Scratch.Get "queries") "&" | safeHTML }}" width="100%" height="{{ $.Scratch.Get "k_height" }}" frameborder="0" scrolling="no"></iframe>
When I use the following in my page I get the embed code but in the query parameters the assignment character is replaced with the hex code in percent notation. So the following
{{< komoot id="268099695" profile="1" >}}
will return the following code in the HTML
<iframe src="https://www.komoot.nl/tour/268099695/embed?profile%3d1" width="100%" height="680" frameborder="0" scrolling="no"></iframe>
I’ve tried adding the safeHTML
already but this doesn’t seem to work. What am I missing here?