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

github.com/yihui/hugo-xmag.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel W. Flint <swflint@flintfam.org>2022-02-19 06:57:11 +0300
committerGitHub <noreply@github.com>2022-02-19 06:57:11 +0300
commitd1499ad03083f9513970006f7a2b99dc9a9c4b5e (patch)
tree7b91aefff4dc17b68c5365950fdff86a076bfa74
parent870785822ce48671fb93e2c6adb67808a5e23782 (diff)
Allow the use of a thumbnail that's a part of a page bundle (#19)
-rw-r--r--layouts/_default/list.html8
1 files changed, 6 insertions, 2 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 395fd5b..5c1ac2c 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -23,14 +23,18 @@
</div>
<div class="summary">
<a href="{{ .RelPermalink }}">
- {{ with .Params.thumbnail }}
- <div class="thumbnail"><img src="{{ relURL . }}" alt="Thumbnail" /></div>
+ {{ with .Resources.GetMatch (printf "%s" .Params.thumbnail) }}
+ <div class="thumbnail"><img src="{{ relURL .Permalink }}" alt="Thumbnail" /></div>
+ {{ else }}
+ {{ with .Params.thumbnail }}
+ <div class="thumbnail"><img src="{{ relURL .}}" alt="Thumbnail" /></div>
{{ else }}
{{ $img := findRE "<img src=\"[^\"]+\"" .Content 1 }}
{{ range $img }}
<div class="thumbnail">{{ (print . " alt=\"Thumbnail\" />") | safeHTML }}</div>
{{ end }}
{{ end }}
+ {{ end }}
{{ with .Description }}
{{ $.Scratch.Set "summary" (markdownify .) }}
{{ else }}