Clean up partial calls in figures/image
- Include the custom class passed to the template - Factor out multiple computations of $shouldShowTitle into a variable and pass that to called partials
This commit is contained in:
parent
734fe626a3
commit
a1c22b3491
1 changed files with 6 additions and 4 deletions
|
@ -1,7 +1,5 @@
|
|||
{{- $imgs := slice -}}
|
||||
{{- $class := .Get "class" -}}
|
||||
{{- $shouldResize := .Get "shouldResize" | default true -}}
|
||||
{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}}
|
||||
|
||||
{{- if .Get "name" -}}
|
||||
{{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}}
|
||||
|
@ -17,6 +15,8 @@
|
|||
{{ errorf "No images found for name(s) parameter" }}
|
||||
{{- end -}}
|
||||
|
||||
{{- $class := .Get "class" -}}
|
||||
{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}}
|
||||
{{- $size := .Get "size" | default "full" -}}
|
||||
|
||||
{{ if in (slice "full" "main") $size }}
|
||||
|
@ -25,7 +25,8 @@
|
|||
"page" $.Page
|
||||
"name" (.Get "name")
|
||||
"size" $size
|
||||
"shouldShowTitle" (.Get "shouldShowTitle" | default true)
|
||||
"class" $class
|
||||
"shouldShowTitle" $shouldShowTitle
|
||||
)
|
||||
}}
|
||||
{{ else if eq $size "small" }}
|
||||
|
@ -34,7 +35,8 @@
|
|||
"page" $.Page
|
||||
"name" (.Get "name")
|
||||
"size" $size
|
||||
"shouldShowTitle" (.Get "shouldShowTitle" | default true)
|
||||
"class" $class
|
||||
"shouldShowTitle" $shouldShowTitle
|
||||
)
|
||||
}}
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue