From 7729d0a1328463baf87517b3516f82aa173df954 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sat, 8 Jan 2022 11:33:13 +0100 Subject: [PATCH] show backlinks to ilink shortcodes (if showBacklinks site param is set --- i18n/de.yaml | 5 ++++- i18n/en.yaml | 5 ++++- layouts/partials/list-item.html | 8 ++++++-- layouts/partials/sidebar.html | 6 ++++++ layouts/shortcodes/ilink.html | 9 ++++----- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/i18n/de.yaml b/i18n/de.yaml index f9d4ffc..0b9a1c3 100644 --- a/i18n/de.yaml +++ b/i18n/de.yaml @@ -1,5 +1,5 @@ # -# de.yaml 2022-01-06 +# de.yaml 2022-01-08 # about: @@ -20,6 +20,9 @@ articles-in-section: author: other: Autor +backlinks: + other: Verlinkte Seiten + child-articles: other: Untergeordnete Artikel diff --git a/i18n/en.yaml b/i18n/en.yaml index 3796bb7..aaf1cf0 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -1,5 +1,5 @@ # -# en.yaml 2022-01-06 +# en.yaml 2022-01-08 # about: @@ -20,6 +20,9 @@ articles-in-section: author: other: Author +backlinks: + other: Backlinks + child-articles: other: Child Articles diff --git a/layouts/partials/list-item.html b/layouts/partials/list-item.html index 56a0edb..785407c 100644 --- a/layouts/partials/list-item.html +++ b/layouts/partials/list-item.html @@ -1,6 +1,10 @@ -{{ range . -}} +{{ range $idx, $page := . -}}
  • - {{ .Title }}   {{ if .Date -}} {{ .Date.Format (i18n "dateFormat") }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 8111850..13a5fb8 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -69,6 +69,12 @@ (dict "related" $related "header" $header "id" "articles-in-section") -}} {{- end }} + {{ if .Site.Params.showBacklinks -}} + {{- $related := .Scratch.Get "backlinks" -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "backlinks") "id" "backlinks") -}} + {{- end }} + {{ if .Params.toc -}}