Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alex-shpak/hugo-book.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Masino <dev.gmasino@pm.me>2022-02-18 19:35:02 +0300
committerGitHub <noreply@github.com>2022-02-18 19:35:02 +0300
commit98d19b8e95019534622fd4c5eae707423730df2c (patch)
treeb1ea8a449a8e6d2eae736ba7e6de990e4ba8340f
parent5581ec08455588fa0c959a559d71b631beebae91 (diff)
Make menu entries' link relative (#421)
This change allows hugo to build pages correcly when `canonifyURLs = false` and `relativeURLs = true`. Otherwise the links on the menu will be canonicalized regardless of configuration. This results in broken sites in a number of situations, such as sites served behind a reverse-proxy that don't want to account for the prefix they're served under.
-rw-r--r--layouts/partials/docs/menu-filetree.html4
1 files changed, 2 insertions, 2 deletions
diff --git a/layouts/partials/docs/menu-filetree.html b/layouts/partials/docs/menu-filetree.html
index f8290df..dd61af7 100644
--- a/layouts/partials/docs/menu-filetree.html
+++ b/layouts/partials/docs/menu-filetree.html
@@ -31,12 +31,12 @@
{{ if .Page.Params.bookCollapseSection }}
<input type="checkbox" id="section-{{ md5 .Page }}" class="toggle" {{ if or $current $ancestor }}checked{{ end }} />
<label for="section-{{ md5 .Page }}" class="flex justify-between">
- <a {{ if .Page.Content }}href="{{ .Page.Permalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
+ <a {{ if .Page.Content }}href="{{ .Page.RelPermalink }}"{{ else }}role="button"{{ end }} class="{{ if $current }}active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
</label>
{{ else if .Page.Content }}
- <a href="{{ .Page.Permalink }}" class="{{ if $current }} active{{ end }}">
+ <a href="{{ .Page.RelPermalink }}" class="{{ if $current }} active{{ end }}">
{{- partial "docs/title" .Page -}}
</a>
{{ else }}