From e17520cfaa2beab6b9f37cc5da8f694011e893fa Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 18 May 2018 19:19:04 +0100 Subject: [PATCH] Add alt attributes for content images --- layouts/shortcodes/figure.html | 8 ++++++-- layouts/shortcodes/resource.html | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 38c727a..9b1dfc6 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,10 +1,14 @@ +{{ define "img" }} + {{ .Inner | plainify }} +{{ end }} + {{ if .Inner }}
- + {{ template "img" . }}
{{ .Inner }}
{{ else }} - + {{ template "img" . }} {{ end }} diff --git a/layouts/shortcodes/resource.html b/layouts/shortcodes/resource.html index 1829952..d7b1a0a 100644 --- a/layouts/shortcodes/resource.html +++ b/layouts/shortcodes/resource.html @@ -13,15 +13,19 @@ {{ .Scratch.Set "image" ($original.Fill $options) }} {{ end }} -{{ $image := .Scratch.Get "image" }} + +{{ define "img" }} + {{ $image := .Scratch.Get "image" }} + {{ .Inner | plainify }} +{{ end }} {{ if .Inner }}
- + {{ template "img" . }}
{{ .Inner }}
{{ else }} - + {{ template "img" . }} {{ end }}