Skip to content

Commit ced4355

Browse files
committed
update image
1 parent 95abfeb commit ced4355

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

layouts/_default/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{- $.Scratch.Add "index" slice -}}
22
{{- range site.RegularPages -}}
33
{{- if and (not .Params.searchHidden) (ne .Layout `archives`) (ne .Layout `search`) }}
4-
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary "date" (.Date.Format "2006-01-02") "image" ((print .Site.BaseURL .Params.image) | absURL)) -}}
4+
{{- $.Scratch.Add "index" (dict "title" .Title "content" .Plain "permalink" .Permalink "summary" .Summary "date" (.Date.Format "2006-01-02") "image" {{- if hasPrefix .Params.image "http"} (( print .Params.image )) {{- else -}}((print .Site.BaseURL .Params.image) | absURL)) {{ end -}} -}}
55
{{- end }}
66
{{- end -}}
77
{{- $.Scratch.Get "index" | jsonify -}}

layouts/_default/list.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ <h2 class="tags__title">{{ .Title }}</h2>
2323
<div class="results">
2424
{{- $pages := union .RegularPages .Sections }}
2525
{{ range $pages }}
26+
{{ $image := .Params.image }}
27+
{{if hasPrefix $image "http" }}
28+
{{ else }}
29+
{{ $image = print .Site.BaseURL .Params.image }}
2630
<div class="resultItem">
27-
<div class="resultItem__media" style="background-image: url({{ (print .Site.BaseURL .Params.image) | absURL }});"></div>
31+
<div class="resultItem__media" style="background-image: url({{ (print $image ) | absURL }});"></div>
2832
<div class="resultItem__body">
2933
<h3 class="resultItem__title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3>
3034
<div class="resultItem__footer">{{ .Date.Format "2006-01-02" }}</div>

0 commit comments

Comments
 (0)