hugo-theme-learn icon indicating copy to clipboard operation
hugo-theme-learn copied to clipboard

Issue with setting landingPageURL being reliant on languages

Open amlwwalker opened this issue 2 years ago • 1 comments

If you want to serve Hugo using this theme on xyz.com/tutorials

then in config.toml you can set

baseURL = 'https://xyz.com/tutorials'

this will fix all the links between pages to use the /tutorials path as part of every URL

However this doesn't fix the "Home" or Icon links, which take you to the root of the domain (i.e xyz.com) rather than xyz.com/tutorials.

Looking at the code for these:

The logo has the link:

<a id="logo" href='{{ (cond (and (ne .Site.Params.landingPageURL nil) (.Site.IsMultiLingual)) .Site.Params.landingPageURL "/") }}'>

and the Home button has the link

<a class="padding" href='{{ (cond (and (ne .Site.Params.landingPageURL nil) (.Site.IsMultiLingual)) .Site.Params.landingPageURL "/") }}'>{{ safeHTML (cond (ne .Site.Params.landingPageName nil) .Site.Params.landingPageName "<i class='fas fa-home'></i> Home") }}</a>

in both cases then it suggests that setting the landingPageURL='/tutorials in config would be what is required however, and I think its a bug, this actually would only work if multiple languages are set, i.e to be able to specify a path on the Home/logo links you need multi language (IsMultiLingual) but you don't need multilanguage to update the base URL?

I think that there is a bug that means that the path/url for these is reliant on multi language and that shouldn't be a requirement?

Shouldn't the baseURL be the default (otherwise / ) for Home/Icon link?

amlwwalker avatar Jan 28 '22 10:01 amlwwalker

This was fixed by @helfper in the fork. Feel free to check it out.

McShelby avatar Mar 09 '22 22:03 McShelby