refactor: simplify article-list/tile partial context passing (#1295)
refactor: simplify `article-list/tile` partial context passing and internal usage.
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
{{ $image := partial "helper/image" (dict "Image" .context.Params.image "Resources" .context.Resources "Context" .context) }}
|
||||
{{ $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources "Context" .) }}
|
||||
<article class="{{ if $image }}has-image{{ end }}">
|
||||
<a href="{{ .context.RelPermalink }}">
|
||||
<a href="{{ .RelPermalink }}">
|
||||
{{ if $image }}
|
||||
<div class="article-image">
|
||||
{{ partial "helper/thumbnail-image" (dict
|
||||
"Resource" $image.Resource
|
||||
"Width" 250
|
||||
"Height" 150
|
||||
"Resize" .context.Site.Params.ImageProcessing.Thumbnail.Enabled
|
||||
"Resize" .Site.Params.ImageProcessing.Thumbnail.Enabled
|
||||
"Attributes" (dict
|
||||
"src" $image.Permalink
|
||||
"alt" (printf "Featured image of post %s" .context.Title)
|
||||
"alt" (printf "Featured image of post %s" .Title)
|
||||
"loading" "lazy"
|
||||
"width" $image.Width
|
||||
"height" $image.Height
|
||||
@@ -30,7 +30,7 @@
|
||||
{{- end -}}
|
||||
>
|
||||
<h2 class="article-title">
|
||||
{{- .context.Title -}}
|
||||
{{- .Title -}}
|
||||
</h2>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="subsection-list">
|
||||
<div class="article-list--tile">
|
||||
{{ range . }}
|
||||
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "articleList") }}
|
||||
{{ partial "article-list/tile" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<div class="subsection-list">
|
||||
<div class="article-list--tile">
|
||||
{{ range $terms }}
|
||||
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }}
|
||||
{{ partial "article-list/tile" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@
|
||||
<div class="subsection-list">
|
||||
<div class="article-list--tile">
|
||||
{{ range . }}
|
||||
{{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "section") }}
|
||||
{{ partial "article-list/tile" . }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user