From bfdb0e60d51b1669f11a308826b3d15385cf7f05 Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Fri, 18 Sep 2020 08:25:12 +0000
Subject: [PATCH] Alternative thumbnail
---
exampleSite/content/post/markdown-syntax.md | 2 +-
exampleSite/content/post/rich-content.md | 2 +-
exampleSite/content/post/emoji-support.md | 2 +-
layouts/index.html | 10 +++++-----
assets/css/style.css | 11 +++++++++++
5 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/assets/css/style.css b/assets/css/style.css
index 9709749..a51906f 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -488,6 +488,17 @@
max-height: 100%;
}
+/* Alternative Thumbnail */
+.post-thumbnail {
+ width: 100%;
+ padding-bottom: 1em;
+ height: auto;
+}
+
+.post-thumbnail img {
+ width: 100%;
+}
+
.pagination {
margin: 30px;
padding: 0px 0 56px 0;
diff --git a/exampleSite/content/post/emoji-support.md b/exampleSite/content/post/emoji-support.md
index 8c2cade..b7885e9 100644
--- a/exampleSite/content/post/emoji-support.md
+++ b/exampleSite/content/post/emoji-support.md
@@ -7,7 +7,7 @@
"emoji",
]
[thumbnail]
- src = "http://placeimg.com/150/150/any?2"
+ src = "http://placeimg.com/1200/400/any?2"
alt = "Thumbnail image"
+++
diff --git a/exampleSite/content/post/markdown-syntax.md b/exampleSite/content/post/markdown-syntax.md
index 995aa79..cd86d40 100644
--- a/exampleSite/content/post/markdown-syntax.md
+++ b/exampleSite/content/post/markdown-syntax.md
@@ -16,7 +16,7 @@
series = ["Themes Guide"]
aliases = ["migrate-from-jekyl"]
[thumbnail]
- src = "http://placeimg.com/150/150/any?1"
+ src = "http://placeimg.com/1200/400/any?1"
alt = "Thumbnail image"
+++
diff --git a/exampleSite/content/post/rich-content.md b/exampleSite/content/post/rich-content.md
index f1cc692..d13b5ff 100644
--- a/exampleSite/content/post/rich-content.md
+++ b/exampleSite/content/post/rich-content.md
@@ -8,7 +8,7 @@
"privacy",
]
[thumbnail]
- src = "http://placeimg.com/150/150/any?3"
+ src = "http://placeimg.com/1200/400/any?3"
alt = "Thumbnail image"
+++
diff --git a/layouts/index.html b/layouts/index.html
index dbd9081..69cffb9 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -3,6 +3,11 @@
{{ range $paginator.Pages }}
<div class="post animated fadeInDown preview">
<div class="post-text">
+ {{ with .Params.thumbnail }}
+ <div class="post-thumbnail">
+ <img src="{{ .src | absURL }}" alt="{{ .alt | default "" }}" loading="lazy">
+ </div>
+ {{ end }}
<div class="post-title">
<h3><a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h3>
@@ -26,11 +31,6 @@
</div>
</div>
</div>
- {{ if isset .Params "thumbnail" }}
- <div class="thumbnail">
- <img src="{{ .Params.thumbnail | absURL }}" loading="lazy">
- </div>
- {{ end }}
</div>
{{ end }}
<div class="pagination">
--
Gitblit v1.10.0