Wrong navbar-brand href attribute with Wowchemy Academic

Hi,

I am new to Hugo, I am using WowChemy Academic theme for my personal webpage (link). Everything works fine except for the title on top, it links to a parent directory.

I know that this problem can be fixed using

relativeURLS: true
canonifyurls: true

However, relativeurls and canonifyurls create an issue with the “cite” button (under “publications”). I wonder if there is a simple way to customize the link in the title.

If needed, here’s my github repo and I am using v0.104.3+extended locally. Many thanks in advance.

cc: @alcarazr

I saw your post on the Discord server but I’m not sure how to fix it. Citations are dynamically injected via JS, but I can’t see what do you need to change :thinking:

I figured that fixing the citation button would not be easy. I was thinking that maybe changing the link in the title would be easier but I do not see how to do it in the Hugo documentation.

@alcarazr

This is a Wowchemy issue when running Hugo v0.101.0 or later when the site is served from a subdirectory (example: baseURL = "https://example.org/foo/").

See:

The behavior of the relURL and relLangURL functions was incorrect with v0.100.2 and earlier (see this issue).

Instead of

<a class="navbar-brand" href="{{ "/" | relLangURL }}">

I would do something like:

<a class="navbar-brand" href="{{ site.Home.RelPermalink }}">

@Hmegh

Until this is fixed by the Wowchemy team, you can override the navbar partial.

mkdir -p layouts/partials
hugo mod vendor
cp _vendor/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5/layouts/partials/navbar.html layouts/partials/
rm -r _vendor

Then edit lines 22 and 43 of layouts/partials/navbar.html as suggested above.

Once you make the change, make sure to update HUGO_VERSION in your Netlify configuration to v0.101.0 or later, preferably the latest release (v0.105.0).

2 Likes

This solved the issue. Thank you!!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.