Improved read next ('More in x') post cards
parent
75b97cc875
commit
3568fac4e6
|
@ -1,7 +1,7 @@
|
|||
<article class="post-card post
|
||||
{{ if not (.context.Param "thumbnail") }} no-image
|
||||
{{ else }}
|
||||
{{ if (eq (mod .index 6) 0) }} post-card-large {{ end }}
|
||||
{{ if (eq (mod .index 6) 0) }} post-card-large {{ end }}{{ .isLarge }}
|
||||
{{ end }} ">
|
||||
|
||||
{{ if .context.Param "thumbnail" }}
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
<footer class="post-card-meta">
|
||||
{{ if ne .context.Section "tags" }}
|
||||
<span class="post-card-byline-date"><a href="{{ .context.CurrentSection.Permalink }}">{{ .context.Section }}</a> <span class="bull">•</span> <time datetime="{{ .context.Date.Format "2006-31-01" }}">{{ .context.Date.Format "2 January 2006" }}</time>
|
||||
<span class="post-card-byline-date">{{ if ne .isMoreCard "yes" }}<a href="{{ .context.CurrentSection.Permalink }}">{{ .context.Section }}</a> <span class="bull">•</span> {{ end }}<time datetime="{{ .context.Date.Format "2006-31-01" }}">{{ .context.Date.Format "2 January 2006" }}</time>
|
||||
{{ if ne .context.Lastmod .context.Date }}
|
||||
<span class="bull">•</span><span class="post-card-byline-date"><time datetime="{{ .context.Lastmod.Format "2006-31-01" }}"> <svg class="byline-meta-symbol" xmlns="http://www.w3.org/2000/svg" height="16" viewBox="0 -1000 960 960" width="16" fill="currentColor"><path d="M180-180h44l443-443-44-44-443 443v44Zm614-486L666-794l42-42q17-17 42-17t42 17l44 44q17 17 17 42t-17 42l-42 42Zm-42 42L248-120H120v-128l504-504 128 128Zm-107-21-22-22 44 44-22-22Z"/></svg> {{ .context.Lastmod.Format "2 January 2006" }}</time>
|
||||
{{ end }}
|
||||
|
|
|
@ -9,13 +9,31 @@
|
|||
|
||||
<!-- {{- partial "read-next.html" . -}} -->
|
||||
|
||||
{{ if and (.PrevInSection) (.NextInSection) }} <!-- if both exist, display both normal cards -->
|
||||
|
||||
{{ with .PrevInSection}}
|
||||
{{- partial "post-card.html" (dict "context" . "index" 1) -}}
|
||||
{{- partial "post-card.html" (dict "context" . "index" 1 "isMoreCard" "yes") -}}
|
||||
{{end}}
|
||||
|
||||
{{ with .NextInSection}}
|
||||
{{- partial "post-card.html" (dict "context" . "index" 1) -}}
|
||||
{{- partial "post-card.html" (dict "context" . "index" 1 "isMoreCard" "yes") -}}
|
||||
{{end}}
|
||||
|
||||
{{ else }} <!-- otherwise check for each one and print a large card for whichever one exists -->
|
||||
|
||||
{{ if .PrevInSection }}
|
||||
{{ with .PrevInSection}}
|
||||
{{- partial "post-card.html" (dict "context" . "index" 1 "isMoreCard" "yes" "isLarge" "post-card-large") -}}
|
||||
{{end}}
|
||||
{{ end }}
|
||||
|
||||
{{ if .NextInSection }}
|
||||
{{ with .NextInSection}}
|
||||
{{- partial "post-card.html" (dict "context" . "index" 1 "isMoreCard" "yes" "isLarge" "post-card-large") -}}
|
||||
{{end}}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
|
Loading…
Reference in New Issue