From 7f14e157e12d435a498d9005e2c21efa07bdb0a8 Mon Sep 17 00:00:00 2001 From: Yanislav Igonin Date: Sun, 24 Oct 2021 12:40:07 +0300 Subject: [PATCH] feat: first post image as seo image --- templates/meta-tags-dynamic.html | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/templates/meta-tags-dynamic.html b/templates/meta-tags-dynamic.html index 672e6dc..95aa2f3 100644 --- a/templates/meta-tags-dynamic.html +++ b/templates/meta-tags-dynamic.html @@ -1,4 +1,13 @@ {{ define "meta-tags-dynamic" }} + +{{ $SeoImageUrl := "" }} +{{ if .Files }} + {{ $FirstFile := index .Files 0 }}ы + {{ $SeoImageUrl = printf "https://micrach.igonin.dev/uploads/%d/t/%d.%s" .ID $FirstFile.ID $FirstFile.Ext }} +{{ else }} + {{ $SeoImageUrl = "https://memepedia.ru/wp-content/uploads/2018/03/ebanyy-rot-etogo-kazino.png" }} +{{ end }} + {{ .Title }} @@ -11,12 +20,12 @@ - + - + - + {{ end }} \ No newline at end of file