gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
75.9k stars 7.54k forks source link

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

Closed ktmud closed 10 years ago

ktmud commented 10 years ago

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="http://mysite.com/porfolio//en/abc">English</a>
github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.