mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
Move showcase items in list view to a template in the layout
This seems more efficient to me than keeping it in a partial, being that it won't be used elsewhere and will help keep "partial-srprawl" down.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
f34620e905
commit
d1415795be
@@ -1,14 +0,0 @@
|
||||
<a href="{{.Permalink}}" class="b--moon-gray ba bg-animate bg-white db flex-auto-ns hover-bg-near-white mb3 mr3 w-100 w-40-l">
|
||||
<div class="flex flex-column black h-100 mb2 pa3 pa4-l">
|
||||
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ with $img }}
|
||||
{{ $img := .Fill "600x300 top" }}
|
||||
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI5MDAiIHZpZXdCb3g9IjAgMCAxNjAwIDkwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48dGl0bGU+UmVjdGFuZ2xlPC90aXRsZT48ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz48ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cmVjdCBpZD0iUmVjdGFuZ2xlIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI5MDAiLz48L2c+PC9zdmc+" data-src="{{ .RelPermalink }}" class="grow img lazyload" />
|
||||
{{end}}
|
||||
<div style="margin-top:auto;">{{/* the margin aligns to the bottom */}}
|
||||
<h2 class="dib f3 mt4">
|
||||
{{- .Title -}}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
@@ -9,8 +9,8 @@
|
||||
</div>
|
||||
</article>
|
||||
<section class="flex-ns flex-wrap justify-between w-100 v-top">
|
||||
{{ range (.Paginator 20).Pages }}
|
||||
{{ partial "boxes-showcase-items.html" . }}
|
||||
{{ range (.Paginator 20).Pages }}
|
||||
{{template "showcase_items" .}}
|
||||
{{ end }}
|
||||
</section>
|
||||
<div class="nested-list-reset nested-links">
|
||||
@@ -19,3 +19,23 @@
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
{{define "showcase_items"}}
|
||||
<a href="{{.Permalink}}" class="b--moon-gray ba bg-animate bg-white db flex-auto-ns hover-bg-near-white mb3 mr3 w-100 w-40-l">
|
||||
<div class="flex flex-column black h-100 mb2 pa3 pa4-l">
|
||||
{{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
{{ with $img }}
|
||||
{{ $img := .Fill "600x300 top" }}
|
||||
<img src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI5MDAiIHZpZXdCb3g9IjAgMCAxNjAwIDkwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48dGl0bGU+UmVjdGFuZ2xlPC90aXRsZT48ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz48ZyBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cmVjdCBpZD0iUmVjdGFuZ2xlIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTYwMCIgaGVpZ2h0PSI5MDAiLz48L2c+PC9zdmc+" data-src="{{ .RelPermalink }}" class="grow img lazyload" />
|
||||
{{end}}
|
||||
<div style="margin-top:auto;">{{/* the margin aligns to the bottom */}}
|
||||
<h2 class="dib f3 mt4">
|
||||
{{- .Title -}}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user