Logo image and Home button breaks for baseURL with subpaths (redirects to wrong address) when `landingPageURL` is present and MultiLingual mode isn't supported #463
When baseURL contains subpath, landingPageURL is defined but there is no support for multiple languages
both logo and Home button redirects to "/" which will not match baseURL when it contains subpaths
More details:
Because .Site.IsMultiLingual variable is requirement for home button to use .Site.Params.landingPageURL
It's not possible change landingPageURL without defining multiple languages (adding section for single language doesn't work either). Fallback value is hardcoded as "/" for both, button and logo URLs.
Proposed solutions:
I did some quick check and found out that removing this in favor of
(cond (ne .Site.Params.landingPageURL nil) .Site.Params.landingPageURL "/")
works just fine and allows for landingPageURL to be defined in [params] section.
But that was very shallow checking (I didn't check this change for multiple languages etc.) so it requires further examination
If there is any reason to enforce multilngual mode requirement,
default fallback value could be changed from hardcoded "/" to .Site.Params.baseURL.
Breaking behavior:
When
baseURL
contains subpath,landingPageURL
is defined but there is no support for multiple languages both logo and Home button redirects to "/" which will not match baseURL when it contains subpathsMore details:
Because
.Site.IsMultiLingual
variable is requirement for home button to use.Site.Params.landingPageURL
https://github.com/matcornic/hugo-theme-learn/blob/master/layouts/partials/menu.html#L17 https://github.com/matcornic/hugo-theme-learn/blob/master/layouts/partials/logo.html#L1
It's not possible change
landingPageURL
without defining multiple languages (adding section for single language doesn't work either). Fallback value is hardcoded as "/" for both, button and logo URLs.Proposed solutions:
I did some quick check and found out that removing this in favor of
(cond (ne .Site.Params.landingPageURL nil) .Site.Params.landingPageURL "/")
works just fine and allows forlandingPageURL
to be defined in[params]
section. But that was very shallow checking (I didn't check this change for multiple languages etc.) so it requires further examinationIf there is any reason to enforce multilngual mode requirement, default fallback value could be changed from hardcoded
"/"
to.Site.Params.baseURL
.