Fix issue when using a baseURL containing a subdir

`| relURL` behaves differently when the string passed to it begins with a slash.
https://gohugo.io/functions/relurl/#input-begins-with-a-slash
This commit is contained in:
John Hollowell 2022-12-28 00:40:21 +00:00
parent 01f9e43e59
commit 8c0c8477d7
5 changed files with 7 additions and 7 deletions

View File

@ -1,14 +1,14 @@
<nav class="navbar scrolling" role="navigation" aria-label="main navigation" data-dir="{{ if $.Param "navbardir" }}{{ $.Param "navbardir" }}{{ else }}{{ $.Param "languagedir" | default "ltr" }}{{ end }}">
<div class="navbar__brand">
{{ if $.Param "logo" | default true }}
<a href="{{ "/" | relLangURL }}" title="{{ i18n "tooltip-home" }}" rel="home" class="{{ if eq ($.Param "logoType") "long" }}navbar__long-link{{ else }}navbar__logo-link{{ end }}">
<img src="{{ "/logo.png" | relURL }}" alt="Home" class="navbar__logo">
<a href="{{ "" | relLangURL }}" title="{{ i18n "tooltip-home" }}" rel="home" class="{{ if eq ($.Param "logoType") "long" }}navbar__long-link{{ else }}navbar__logo-link{{ end }}">
<img src="{{ "logo.png" | relURL }}" alt="Home" class="navbar__logo">
</a>
{{ else }}
&nbsp;&nbsp;
{{ end }}
{{ if ne .Site.Params.logoType "long" }}
<a href="{{ "/" | relLangURL }}" title="{{ i18n "tooltip-home" }}" rel="home" class="navbar__title-link">
<a href="{{ "" | relLangURL }}" title="{{ i18n "tooltip-home" }}" rel="home" class="navbar__title-link">
<h6 class="navbar__title">{{ .Site.Params.logoText }}</h6>
</a>
{{ end }}

View File

@ -10,7 +10,7 @@
var enableSearchHighlight = JSON.parse({{ $enableSearchHighlight | jsonify }});
{{ $isFirstSection := eq .Permalink .FirstSection.Permalink }}
var isFirstSection = JSON.parse({{ $isFirstSection | jsonify }});
{{ $tagsBaseURL := ("/tags/" | relLangURL) }}
{{ $tagsBaseURL := ("tags/" | relLangURL) }}
var tagsBaseURL = JSON.parse({{ $tagsBaseURL | jsonify }});
document.addEventListener('DOMContentLoaded', function () {

View File

@ -2,7 +2,7 @@
<div class="taxo">
<section>
<span class="title p2">
<a href="{{ "/categories/" | relLangURL }}" class="taxo__title">
<a href="{{ "categories/" | relLangURL }}" class="taxo__title">
{{ i18n "categories" }}
</a>
</span>

View File

@ -2,7 +2,7 @@
<div class="taxo">
<section>
<span class="title p2">
<a href="{{ "/series/" | relLangURL }}" class="taxo__title">
<a href="{{ "series/" | relLangURL }}" class="taxo__title">
{{ i18n "series" }}
</a>
</span>

View File

@ -2,7 +2,7 @@
<div class="taxo">
<section>
<span class="title p2">
<a href="{{ "/tags/" | relLangURL }}" class="taxo__title">
<a href="{{ "tags/" | relLangURL }}" class="taxo__title">
{{ i18n "tags"}}
</a>
</span>