hazcod
1
Hi,
Trying to setup a site-wide parameter to store a base URL. In config.yaml:
params:
apiBaseURL: localhost:8081
And used in a layout partial like this:
<script type="text/javascript" id="scriptNav"
data-assetUrl="{{ $.Site.Params.apiBaseURL }}/public/assets/"
src="{{ $jsBaseBundle.Permalink }}" integrity="{{ $jsBaseBundle.Data.Integrity }}" crossorigin="anonymous"></script>
However, data-assetUrl will contain: data-assetUrl="#ZgotmplZ/public/assets/"
Any idea where #ZgotmplZ is coming from?
Itβs an indicator that something is wrong.
My first guess would be to quote the value, e.g.
params:
apiBaseURL: "localhost:8081"
You may want to read more on safeHTMLAttr
function.
<script type="text/javascript" id="scriptNav"
++ data-assetUrl="{{ print $.Site.Params.apiBaseURL "/public/assets/" | safeHTMLAttr }}"
src="{{ $jsBaseBundle.Permalink }}" integrity="{{ $jsBaseBundle.Data.Integrity }}" crossorigin="anonymous"></script>
2 Likes
hazcod
4
@pamubay: thank you! Added that.
@sciurius I found out by doing a {{ print $.Site.Params }}
that the key should be lowercase:
map[apibaseurl:localhost:8081 languagename:English weight:1]
system
Closed
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.