From 9beed385a884a4b3412bc321e4065a54ae245c87 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Sat, 9 Oct 2021 14:09:02 -0500 Subject: [PATCH] Use a custom opengraph template and rename feature-video to just feature --- archetypes/blog/index.md | 10 ++----- layouts/_default/list.html | 4 +-- layouts/partials/head.html | 2 +- layouts/partials/opengraph.html | 52 +++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 11 deletions(-) create mode 100644 layouts/partials/opengraph.html diff --git a/archetypes/blog/index.md b/archetypes/blog/index.md index 5c06aa9..feb552f 100644 --- a/archetypes/blog/index.md +++ b/archetypes/blog/index.md @@ -12,16 +12,10 @@ tags = [ "awesome", ] -# this image will be shown for the article in list pages +# this will be shown for the article in list pages +# currently it can be either an image or video [[resources]] name = "feature" src = "something.webp" title = "Some image (image format can be anything; webp is just an example)" - -# same as above, but a video. only one will be shown; image takes -# priority over video -[[resources]] -name = "feature-video" -src = "whatever.webm" -title = "Whatever video (video format can be anything; webm is just an example)" +++ diff --git a/layouts/_default/list.html b/layouts/_default/list.html index dfe2ccd..0346a5f 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -69,11 +69,11 @@ {{ end }} {{ with .Resources.GetMatch "feature" }} + {{ if eq .MediaType.MainType "image" }}
{{ .Title }}
- {{ else }} - {{ with .Resources.GetMatch "feature-video" }} + {{ else if eq .MediaType.MainType "video" }}