summaryrefslogtreecommitdiff
path: root/layouts/_default
diff options
context:
space:
mode:
authorAditya Telange <21258296+adityatelange@users.noreply.github.com>2020-10-10 19:52:08 +0530
committerAditya Telange <21258296+adityatelange@users.noreply.github.com>2020-10-10 19:52:08 +0530
commita8abbd35452e6a98777e8a618114b0147368d98e (patch)
tree7b3be7808ab61a85cd43da19c11eb1ef42a8805f /layouts/_default
parent3ca79f59fecf0e5473d9e8658f458a31dac35b33 (diff)
post-cover: relative covers need to be explicitely set
* change in d819914 and #13 * previous impl breks sites not using `/static` dir as their static location * hugo supports multiple static directories and previous impl checks only for one * ref : https://gohugo.io/content-management/static-files/ usage change in post-vars => cover: image: '<relative url>' relative: true
Diffstat (limited to 'layouts/_default')
-rw-r--r--layouts/_default/list.html2
-rw-r--r--layouts/_default/single.html2
2 files changed, 2 insertions, 2 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index 474d7f7..0b2f0f3 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -33,7 +33,7 @@
<article class="{{ $class }}">
{{- if .Params.cover.image }}
<figure class="entry-cover">
- {{- if (or (fileExists (path.Join "static" .Params.cover.image)) (hasPrefix .Params.cover.image "http://") (hasPrefix .Params.cover.image "https://")) }}
+ {{- if (ne .Params.cover.relative true) }}
<img src="{{ .Params.cover.image | absURL }}" alt="{{ .Params.cover.alt | plainify }}">
{{- else}}
<img src="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" alt="{{ .Params.cover.alt | plainify }}">
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index a4c847f..ef5d6f3 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -28,7 +28,7 @@
</header>
{{- if .Params.cover.image }}
<figure class="entry-cover">
- {{- if (or (fileExists (path.Join "static" .Params.cover.image)) (hasPrefix .Params.cover.image "http://") (hasPrefix .Params.cover.image "https://")) }}
+ {{- if (ne .Params.cover.relative true) }}
<img src="{{ .Params.cover.image | absURL }}" alt="{{ .Params.cover.alt | plainify }}">
{{- else}}
<img src="{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}" alt="{{ .Params.cover.alt | plainify }}">