diff options
author | Tina <feministclickback@mail36.net> | 2020-05-09 21:06:16 +0300 |
---|---|---|
committer | Tina <feministclickback@mail36.net> | 2020-05-09 21:06:16 +0300 |
commit | 728786a69f6e85c4c3899030db1ca2bab8a68174 (patch) | |
tree | 1241af9c9e6a521d95961caec116bdafbf2a1b12 | |
parent | de303af180fcfd15b23c16889d61b947c9102166 (diff) |
Fixed link to home page in header on translated pages
There is a link to the home page in the header, which is generated by
the .Site.BaseURL variable in header.html layout. This link refers to
the home page of the defaultContentLanguage everywhere, also on
translated pages.
Expected behavior: link to to the translated home page
There can only be one BaseURL, since it is a global variable that can't
be overwritten by language parameters.
According to this:
https://jibecfed.fedorapeople.org/blog-hugo/en/2018/11/building-a-multilingual-static-website-with-hugo/
a fix should be using {{.Site.BaseURL | relLangURL }}
but it is not working. I replaced the .Site.BaseURL with "/" (which is
what is currently the baseURL), and it works.
the relLangURL function seems to be buggy in Hugo: https://github.com/gohugoio/hugo/pull/5369
But I haven't found a solution yet.
-rw-r--r-- | layouts/partials/header.html | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9cda72b..e61ea61 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,6 +1,6 @@ <header class="header {{ if $.Site.Params.languageSwitcher.show }} has-LangNav{{ end }}"> <div class="header__title"> - <a href="{{ $.Site.BaseURL }}" class="header__title__link" alt="Home"> + <a href="{{ "/" | relLangURL }}" class="header__title__link" alt="Home"> {{ if $.Site.Params.logo }} <img src="{{ $.Site.BaseURL }}{{ $.Site.Params.logo }}" class="header__title__logo" alt="{{ $.Site.Title }}"> {{ else }} |