diff --git a/i18n/de.yaml b/i18n/de.yaml index b46c692..718054c 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -1,5 +1,5 @@ # -# de.yaml 2021-11-15 +# de.yaml 2021-11-24 # about: @@ -66,6 +66,9 @@ related: other: Verwandte Artikel related-articles: + other: Thematisch verwandte Artikel + +sibling-articles: other: Verwandte Artikel Teaser: diff --git a/i18n/en.yaml b/i18n/en.yaml index 0d74f7f..a48cf10 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,5 +1,5 @@ # -# en.yaml 2021-11-15 +# en.yaml 2021-11-24 # about: @@ -69,6 +69,9 @@ related: related-articles: other: Related Posts +sibling-articles: + other: Sibling Posts + Teaser: other: Teaser diff --git a/layouts/partials/card-related.html b/layouts/partials/card-related.html new file mode 100644 index 0000000..0db032f --- /dev/null +++ b/layouts/partials/card-related.html @@ -0,0 +1,13 @@ +{{- $params := . -}} +{{- with $params.related -}} +
+
+

{{ $params.header }}

+
+
+ +
+
+{{- end -}} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 1018b96..2294b65 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -38,68 +38,35 @@ {{- end }} {{ if not .Site.Params.hideParentArticles -}} - {{- $related := where .Site.RegularPages "Params.pageid" "in" .Params.parents -}} - {{- with $related -}} -
-
-

{{ i18n "parent-articles" }}

-
-
- -
-
- {{- end -}} + {{- $related := where .Site.RegularPages "Params.pageid" "in" .Params.parents -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "parent-articles") "id" "parents") -}} {{- end }} {{ if not .Site.Params.hideChildArticles -}} - {{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}} - {{- with $related -}} -
-
-

{{ i18n "child-articles" }}

-
-
- -
-
- {{- end -}} + {{- $related := .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "child-articles") "id" "children") -}} {{- end }} {{ if not .Site.Params.hideRelatedArticles -}} {{- $related := .Site.RegularPages.RelatedIndices . "topics" -}} - {{- with $related -}} -
-
-

{{ i18n "related-articles" }}

-
-
- -
-
- {{- end -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "related-articles") "id" "related") -}} + {{- end }} + + {{ if not .Site.Params.hideSiblingArticles -}} + {{- $related := .Site.RegularPages.RelatedIndices . "parents" -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "sibling-articles") "id" "siblings") -}} {{- end }} {{ if not .Site.Params.hideSectionArticles -}} {{- $section := or .Section "posts" -}} + {{- $header := or (i18n (printf "articles-in-%s" $section)) (i18n "articles-in-section") -}} {{- $related := first 20 (where .Site.RegularPages "Section" $section) -}} - {{- with $related -}} -
-
-

{{ or (i18n (printf "articles-in-%s" $section)) (i18n "articles-in-section") }}

-
-
- -
-
- {{- end }} + {{- partial "card-related" + (dict "related" $related "header" $header "id" "articles-in-section") -}} {{- end }}