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 @@ ...@@ -52,12 +52,12 @@
<div class="media"> <div class="media">
{{- if .Params.image -}} {{- if .Params.image -}}
{{- partial "commons/image.html" {{- partial "commons/image.html"
(dict (dict
"image" .Params.image "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 -}} {{- else -}}
{{- partial "commons/image-default.html" -}} {{- partial "commons/image-default.html" (dict "type" "posts") -}}
{{- end -}} {{- end -}}
</div> </div>
</article> </article>
......
{{- partial "commons/image.html" {{ if and site.Params.events.default_image site.Data.website.default_image }}
(dict
"image" site.Data.website.default_image {{ $type := .type}}
) -}} {{ $image := site.Data.website.default_image }}
\ No newline at end of file
{{ 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 @@ ...@@ -83,16 +83,15 @@
{{ end }} {{ end }}
</div> </div>
<div class="media"> <div class="media">
{{- $event_image := cond (isset .Params "image") .Params.image ( and (.Site.Params.events.default_image) (site.Data.website.default_image)) -}} {{- if .Params.image -}}
{{- if $event_image -}}
{{- partial "commons/image.html" {{- partial "commons/image.html"
(dict (dict
"image" $event_image "image" .Params.image
"sizes" site.Params.image_sizes.sections.events.item "sizes" site.Params.image_sizes.sections.events.item
) -}} ) -}}
{{/* {{- else if site.Data.website.default_image -}} {{- else -}}
{{- partial "commons/image-default.html" -}} */}} {{- partial "commons/image-default.html" (dict "type" "events") -}}
{{- end -}} {{- end -}}
</div> </div>
</article> </article>
{{ end }} {{ end }}
\ No newline at end of file
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
{{- partial "commons/image.html" {{- partial "commons/image.html"
(dict (dict
"image" .Params.image "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 -}} {{- else -}}
{{- partial "commons/image-default.html" -}} {{- partial "commons/image-default.html" (dict "type" "posts") -}}
{{- end -}} {{- end -}}
</div> </div>
</article> </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