From ea43359ed79c412dba865780f1c8a4e641081cf0 Mon Sep 17 00:00:00 2001
From: Regis Philibert <login@regisphilibert.com>
Date: Thu, 07 Apr 2022 17:32:12 +0000
Subject: [PATCH] Add “no" localization Only print a "by" for some languages Add "by" template for easy overwrite

---
 layouts/_default/by.html     |    3 +++
 layouts/_default/single.html |   14 +++++++-------
 i18n/no.toml                 |    3 +++
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/i18n/no.toml b/i18n/no.toml
index d6165f6..40b2aca 100644
--- a/i18n/no.toml
+++ b/i18n/no.toml
@@ -10,6 +10,9 @@
 [readMore]
 other = "Les mer"
 
+[by]
+other = "Av"
+
 [whatsInThis]
 other = "Innhold av {{ .Type }}"
 
diff --git a/layouts/_default/by.html b/layouts/_default/by.html
new file mode 100644
index 0000000..2170065
--- /dev/null
+++ b/layouts/_default/by.html
@@ -0,0 +1,3 @@
+{{- if eq .Lang "de" "en" "es" "fr" "it" "no" "pt" -}}
+{{- i18n "by" -}}
+{{ end -}}
\ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index adb0c60..a40a4c5 100755
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -20,13 +20,13 @@
       </h1>
       {{ with .Params.author | default .Site.Params.author }}
       <p class="tracked">
-          {{ i18n "by" }} <strong>
-          {{ if reflect.IsSlice . }}
-              {{ delimit . ", " | markdownify }}
-          {{else}}
-              {{ . | markdownify }}
-          {{ end }}
-          </strong>
+        {{ $.Render "by" }} <strong>
+        {{- if reflect.IsSlice . -}}
+            {{ delimit . ", " | markdownify }}
+        {{- else -}}
+            {{ . | markdownify }}
+        {{- end -}}
+        </strong>
       </p>
       {{ end }}
       {{/* Hugo uses Go's date formatting is set by example. Here are two formats */}}

--
Gitblit v1.10.0