Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/chipzoller/hugo-clarity.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Boothe <git@rootwork.org>2022-04-08 01:59:50 +0300
committerIvan Boothe <git@rootwork.org>2022-04-08 01:59:50 +0300
commitdcb38c422bb25d2e94cb4971f77ee3fbbe6247a7 (patch)
treed016430806e7898063f68e0759a0b55d4fc77cd6
parentf940cc910a6919e072e406fb25c39b78cc8705dd (diff)
passing title of post as alt text in content-list situations
Signed-off-by: Ivan Boothe <git@rootwork.org>
-rw-r--r--layouts/partials/excerpt.html2
-rw-r--r--layouts/partials/image.html5
2 files changed, 5 insertions, 2 deletions
diff --git a/layouts/partials/excerpt.html b/layouts/partials/excerpt.html
index bc7a9f3..8bdaa79 100644
--- a/layouts/partials/excerpt.html
+++ b/layouts/partials/excerpt.html
@@ -9,7 +9,7 @@
{{- with .Params.thumbnail }}
<div class="excerpt_footer partition">
<div class="excerpt_thumbnail">
- {{- partial "image" (dict "file" . "type" "thumbnail") }}
+ {{- partial "image" (dict "file" . "alt" $.Title "type" "thumbnail") }}
</div>
{{ else }}
<div class="excerpt_footer">
diff --git a/layouts/partials/image.html b/layouts/partials/image.html
index f62618d..8aed4b6 100644
--- a/layouts/partials/image.html
+++ b/layouts/partials/image.html
@@ -1,5 +1,8 @@
{{- $file := .file -}}
-{{- $alt := .Text -}}
+{{- $alt := .alt -}}
+{{- if not $alt -}}
+ {{- $alt = .Text -}}
+{{- end -}}
{{- $cap := .Title -}}
{{- $scratch := newScratch -}}
{{- $scratch.Set "classes" "image_figure" -}}