From b613cfb58bf4b3c2acc8f46f661f1814744620da Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Sun, 25 Dec 2022 18:14:27 +0200 Subject: [PATCH] docs: improve social image partial (#37717) * Fix social image URL to be absolute * Deduplicate social.html * Get image dimensions with Hugo --- site/layouts/partials/social.html | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/site/layouts/partials/social.html b/site/layouts/partials/social.html index 2226c386c4..f4f556e5a8 100644 --- a/site/layouts/partials/social.html +++ b/site/layouts/partials/social.html @@ -1,15 +1,27 @@ +{{- $pageTitle := .Title | markdownify -}} +{{- $pageDescription := .Page.Params.description | default .Site.Params.description | markdownify -}} +{{- $socialImagePath := printf "/docs/%s/assets" .Site.Params.docs_version -}} + +{{- if .Page.Params.thumbnail -}} + {{- $socialImagePath = path.Join $socialImagePath "img/" .Page.Params.thumbnail -}} +{{- else -}} + {{- $socialImagePath = path.Join $socialImagePath "brand/bootstrap-social.png" -}} +{{- end -}} + - - - + + + - - + + + - - - +{{ with (imageConfig (path.Join "site/static" $socialImagePath)) -}} + + +{{- end }}