Skip to content
Snippets Groups Projects
Commit 3b16978d authored by Olivia206's avatar Olivia206
Browse files

use conditions and types in image-default

parent 35f784cc
No related branches found
No related tags found
No related merge requests found
......@@ -52,12 +52,12 @@
<div class="media">
{{- if .Params.image -}}
{{- partial "commons/image.html"
(dict
"image" .Params.image
"sizes" site.Params.image_sizes.sections.posts.item
) -}}
{{- else if site.Data.website.default_image -}}
{{- partial "commons/image-default.html" -}}
(dict
"image" .Params.image
"sizes" site.Params.image_sizes.sections.events.item
) -}}
{{- else -}}
{{- partial "commons/image-default.html" (dict "type" "posts") -}}
{{- end -}}
</div>
</article>
......
{{- partial "commons/image.html"
(dict
"image" site.Data.website.default_image
) -}}
\ No newline at end of file
{{ if and site.Params.events.default_image site.Data.website.default_image }}
{{ $type := .type}}
{{ $image := site.Data.website.default_image }}
{{ with index site.Params.image_sizes.sections $type }}
{{ $sizes := .items }}
{{- partial "commons/image.html"
(dict
"image" $image
"sizes" $sizes
) -}}
{{ end }}
{{ end }}
\ No newline at end of file
......@@ -83,16 +83,15 @@
{{ end }}
</div>
<div class="media">
{{- $event_image := cond (isset .Params "image") .Params.image ( and (.Site.Params.events.default_image) (site.Data.website.default_image)) -}}
{{- if $event_image -}}
{{- if .Params.image -}}
{{- partial "commons/image.html"
(dict
"image" $event_image
"image" .Params.image
"sizes" site.Params.image_sizes.sections.events.item
) -}}
{{/* {{- else if site.Data.website.default_image -}}
{{- partial "commons/image-default.html" -}} */}}
{{- end -}}
{{- else -}}
{{- partial "commons/image-default.html" (dict "type" "events") -}}
{{- end -}}
</div>
</article>
{{ end }}
\ No newline at end of file
......@@ -53,10 +53,10 @@
{{- partial "commons/image.html"
(dict
"image" .Params.image
"sizes" site.Params.image_sizes.sections.posts.item
"sizes" site.Params.image_sizes.sections.events.item
) -}}
{{- else if site.Data.website.default_image -}}
{{- partial "commons/image-default.html" -}}
{{- else -}}
{{- partial "commons/image-default.html" (dict "type" "posts") -}}
{{- end -}}
</div>
</article>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment