Skip to content

Commit 89adb96

Browse files
committed
link: link resolving stopped working in certain configurations #882
1 parent ef1d5cd commit 89adb96

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

exampleSite/config/_default/params.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,11 @@ imageEffects.shadow = false
343343
# Default: false
344344
# Since the theme provides a link render hook, the usage of the relref shortcode
345345
# is obsolete. If a site still uses that shortcode, it fails to generate a
346-
# correct link if the baseURL is configured with a subdirectory.
346+
# correct links if the baseURL is configured with a subdirectory and relativeURLs=false.
347347
# The theme provides an overriden relref shortcode that also works in the
348-
# above setup. Nevertheless there can be cases where the user want to fallback
349-
# to the default implementation, which can be achieved by setting this option to
350-
# true.
348+
# above setup but must manually be activated by setting this option to true.
351349
# See discussion in https://github.com/McShelby/hugo-theme-relearn/discussions/862
352-
useDefaultRelref = false
350+
disableDefaultRelref = false
353351

354352
# What to do when local page link is not resolved.
355353
# Default: ""

exampleSite/content/basics/migration/_index.en.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,16 @@ This document shows you what's new in the latest release and flags it with one o
3030

3131
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} The theme now comes with its own overridden version of the `relref` shortcode.
3232

33-
While the usage of `relref` is obsolete and discouraged by Hugo for a while, existing installations may use it. In configurations using a `baseURL` with a subdirectory, the default `relref` implementation of Hugo was failing, so an overridden shortcode was necessary.
33+
While the usage of `relref` is obsolete and discouraged by Hugo for a while, existing installations may use it. In configurations using a `baseURL` with a subdirectory, and having `relativeURLs=false` (the default) Hugo's standard `relref` implementation was failing.
34+
35+
The shortcode is deactivated by default and can be activated by setting
36+
37+
{{< multiconfig file=hugo >}}
38+
[params]
39+
disableDefaultRelref = true
40+
{{< /multiconfig >}}
41+
42+
in your `hugo.toml`. Only do this if your site fulfills **all of the above assumptions**.
3443

3544
---
3645

layouts/shortcodes/relref.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{{- if site.Params.useDefaultRelref }}
2-
{{- relref . .Params }}
3-
{{- else }}
1+
{{- if site.Params.disableDefaultRelref }}
42
{{- .Get "path" | default (.Get 0) }}
3+
{{- else }}
4+
{{- relref . .Params }}
55
{{- end }}

0 commit comments

Comments
 (0)