diff options
author | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-07-31 00:00:00 +0000 |
---|---|---|
committer | Nicholas Johnson <nick@nicholasjohnson.ch> | 2023-07-31 00:00:00 +0000 |
commit | be38f8fb7725828bc5c21906b6c0a72bd8403af46eb36f4c78278afe229d8434 (patch) | |
tree | ca724ae46e366c50fbfabf89bc8d2731079815a308cdc644575ee27ca9e6b2d2 | |
parent | 96701f5f94a30f72bb6f3834f0445ce16f899a7e83eed4c74ffd0cc360d4db4e (diff) | |
download | hugo-theme-journal-be38f8fb7725828bc5c21906b6c0a72bd8403af46eb36f4c78278afe229d8434.tar.gz hugo-theme-journal-be38f8fb7725828bc5c21906b6c0a72bd8403af46eb36f4c78278afe229d8434.zip |
Add multilingual support for homepage link
-rw-r--r-- | i18n/en.toml | 3 | ||||
-rw-r--r-- | layouts/_default/single.gmi | 2 | ||||
-rw-r--r-- | layouts/_default/single.html | 2 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.gmi | 2 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.html | 2 | ||||
-rw-r--r-- | layouts/term/term.gmi | 2 | ||||
-rw-r--r-- | layouts/term/term.html | 2 |
7 files changed, 9 insertions, 6 deletions
diff --git a/i18n/en.toml b/i18n/en.toml index b602267..454d56d 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -1,3 +1,6 @@ [readingTime] one = "1 minute read" other = "{{ .Count }} minutes read" + +[returnHome] + other = "Return to homepage" diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index d038c3d..1e56f7f 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -1,6 +1,6 @@ {{ define "main" }} {{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}} -=> / {{ emojify ":link:" | safeHTML }} Return to homepage +=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} {{ if (.Page.Params.pageinfo | default true) }}{{ partial "pageinfo.gmi" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d0cc6a3..ec0ccbb 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,6 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="/" rel="noreferrer">Return to homepage</a></p> + <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> {{- if (.Page.Params.pageinfo | default true) }} <p>{{ partial "pageinfo.html" . }}</p>{{ end }} diff --git a/layouts/taxonomy/taxonomy.gmi b/layouts/taxonomy/taxonomy.gmi index 56b53a9..99fb8f9 100644 --- a/layouts/taxonomy/taxonomy.gmi +++ b/layouts/taxonomy/taxonomy.gmi @@ -1,5 +1,5 @@ {{ define "main" -}} -=> / {{ emojify ":link:" | safeHTML }} Return to homepage +=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} # {{ .Type | humanize }} diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html index a3a22a7..45d64da 100644 --- a/layouts/taxonomy/taxonomy.html +++ b/layouts/taxonomy/taxonomy.html @@ -1,6 +1,6 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="/" rel="noreferrer">Return to homepage</a></p> + <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main> <h1>{{ .Type | humanize }}</h1> diff --git a/layouts/term/term.gmi b/layouts/term/term.gmi index d4c0d7d..e58960b 100644 --- a/layouts/term/term.gmi +++ b/layouts/term/term.gmi @@ -1,5 +1,5 @@ {{ define "main" -}} -=> / {{ emojify ":link:" | safeHTML }} Return to homepage +=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} # {{ .Type | singularize | humanize | safeHTML }} "{{ .Title | safeHTML }}" diff --git a/layouts/term/term.html b/layouts/term/term.html index 4b69ebe..93f537d 100644 --- a/layouts/term/term.html +++ b/layouts/term/term.html @@ -1,6 +1,6 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="/" rel="noreferrer">Return to homepage</a></p> + <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main> <h1>{{ .Type | singularize | humanize }} "{{ .Title }}"</h1> |