From 852c06e55b625c1cadda575af41b2b2e07ad90c5 Mon Sep 17 00:00:00 2001 From: Ral Date: Sun, 16 Jun 2024 19:06:33 +0200 Subject: [PATCH] Extract opengraph code into partial --- layouts/_default/baseof.html | 18 +----------------- layouts/partials/opengraph.html | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 layouts/partials/opengraph.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 968d7ba..f3a16ae 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -9,23 +9,7 @@ {{ $style := resources.Get "/sass/custom.css" | resources.ToCSS $options | resources.Fingerprint }} - - - - - {{ $logoFile := printf "images/ogp/cosin_icon_%s.png" (string .Site.Data.cosin.date_year) }} - {{ $logo := "" }} - {{ with resources.Get $logoFile }} - {{ $logo = . }} - {{ else }} - {{ $logo = resources.Get "images/ogp/cosin_icon_generic.png" }} - {{ end }} - - - - - - + {{ partial "opengraph.html" .}} diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html new file mode 100644 index 0000000..712d0a1 --- /dev/null +++ b/layouts/partials/opengraph.html @@ -0,0 +1,14 @@ +{{ $fileName := printf "images/ogp/cosin_icon_%s.png" (string .Site.Data.cosin.date_year) }} +{{ $logo := or (resources.Get $fileName) (resources.Get "images/ogp/cosin_icon_generic.png") }} + + + + + +{{ with $logo }} + + + + + +{{ end }} -- 2.39.5