trailing slash or no trailing slash for .BaseUrl? #221

ktmud opened this Issue Mar 8, 2014 · 0 comments


None yet
1 participant

ktmud commented Mar 8, 2014

When in develop mode, that is, hugo server at http://localhost:1313,
.Site.BaseUrl has no trailing slash, but when I configured a baseurl in config.yaml,
and run hugo to build, the .BaseUrl is always trailed by a slash.

This makes it ugly when I want to do

{{ if .Params.otherlangs }}
  {{ range $index, $lang := .Params.otherlangs }}
    <a href="{{ $.Site.BaseUrl }}/{{ or (echoParam $.Params.otherurls $index) $lang }}">{{ index $.Site.Params.languages $lang }}</a>
  {{ end }}
{{ end }}

Links generated:

    <a href="http://localhost:1313/en/abc">English</a>
    <a href="">English</a>

@spf13 spf13 closed this in ad34be9 Apr 8, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment