diff --git a/layouts/partials/card.html b/layouts/partials/card.html index b2ff072..f5a38ee 100644 --- a/layouts/partials/card.html +++ b/layouts/partials/card.html @@ -1,18 +1,29 @@
- {{ if .Params.img }} - {{ .Title }} - {{ else if .Params.teaser }} -
-

{{ .Params.teaser }}

-
- {{ else if .Site.Params.defaultImage }} - {{ .Site.Title }} - {{ end }} + {{- $img := .Params.img -}} + {{- $refImg := "" -}} + {{- if .Params.imgRef -}} + {{- range where .Site.RegularPages "Params.pageid" "eq" .Params.imgRef -}} + {{- $refImg = .Params.img -}} + {{- end -}} + {{- end -}} + {{- if not $img -}} + {{- $img = $refImg -}} + {{- end -}} + {{ if $img -}} + {{- $image := (resources.Get (printf "img/%s" $img)).Resize "400x" -}} + {{ .Title }} + {{ else if .Params.teaser }} +
+

{{ .Params.teaser }}

+
+ {{ else if .Site.Params.defaultImage }} + {{ .Site.Title }} + {{ end }}
{{ .Title | truncate 25 }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 4c5ab25..90c0fab 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,89 +1,110 @@
- {{ if .Params.img -}} - {{ .Params.title }} - {{- else if .Params.teaser -}} -
-
-
{{ .Params.teaser }}
-
+ {{- $refImg := "" -}} + {{- $refPage := "" -}} + {{- $img := .Params.img -}} + {{- if .Params.imgRef -}} + {{- range where .Site.RegularPages "Params.pageid" "eq" .Params.imgRef -}} + {{- $refImg = .Params.img -}} + {{- $refPage = . -}} + {{- end -}} + {{- end -}} + {{- if not $img -}} + {{- $img = $refImg -}} + {{- end -}} + + {{ if $img -}} + {{- $image := (resources.Get (printf "img/%s" $img)).Resize "400x" -}} + {{- if $refPage -}} +
{{ .Params.title }} + {{- else -}} + {{ .Params.title }} + {{- end -}} + {{- else if .Params.teaser -}} +
+
+
{{ .Params.teaser }}
- {{- else if .Site.Params.defaultImage -}} - dummy - {{- else if .Params.Summary -}} -
-
-
{{ .Params.Summary }}
-
+
+ {{- else if .Site.Params.defaultImage -}} + Default Dmage + {{- else if .Params.Summary -}} +
+
+
{{ .Params.Summary }}
- {{- end }} +
+ {{- end }} - {{ with .Params.Topics -}} -
-
-

{{i18n "topics"}}

-
-
- {{ range . -}} - {{- $page := $.GetPage (printf "/topics/%s" .) -}} - - {{ $page.Title }} - - {{- end }} -
+ {{ with .Params.Topics -}} +
+
+

{{i18n "topics"}}

- {{- end }} - - {{ if not .Site.Params.hideParentArticles -}} - {{- $related := where .Site.RegularPages "Params.pageid" "in" .Params.parents -}} - {{- partial "card-related" - (dict "related" $related "header" (i18n "parent-articles") "id" "parents") -}} - {{- end }} - - {{ if and (not .Site.Params.hideChildArticles) - (ne .Site.Params.showChildArticles "cards") -}} - {{- $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" -}} - {{- 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) -}} - {{- partial "card-related" - (dict "related" $related "header" $header "id" "articles-in-section") -}} - {{- end }} - - {{ if not .Site.Params.hideBacklinks -}} - {{- $related := .Scratch.Get "backlinks" -}} - {{- partial "card-related" - (dict "related" $related "header" (i18n "backlinks") "id" "backlinks") -}} - {{- end }} - - {{ if .Params.showtoc -}} -
-
-

{{i18n "toc"}}

-
-
- {{ .TableOfContents }} -
+
+ {{ range . -}} + {{- $page := $.GetPage (printf "/topics/%s" .) -}} + + {{ $page.Title }} + + {{- end }}
- {{ end -}} +
+ {{- end }} + + {{ if not .Site.Params.hideParentArticles -}} + {{- $related := where .Site.RegularPages "Params.pageid" "in" .Params.parents -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "parent-articles") "id" "parents") -}} + {{- end }} + + {{ if and (not .Site.Params.hideChildArticles) + (ne .Site.Params.showChildArticles "sidebar") -}} + {{- $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" -}} + {{- 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) -}} + {{- partial "card-related" + (dict "related" $related "header" $header "id" "articles-in-section") -}} + {{- end }} + + {{ if not .Site.Params.hideBacklinks -}} + {{- $related := .Scratch.Get "backlinks" -}} + {{- partial "card-related" + (dict "related" $related "header" (i18n "backlinks") "id" "backlinks") -}} + {{- end }} + + {{ if .Params.showtoc -}} +
+
+

{{i18n "toc"}}

+
+
+ {{ .TableOfContents }} +
+
+ {{ end -}}