mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
⚡ Perf: optimize posts order in collection list (#359)
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<span title="{{ $title }}" class="icon-repost">{{- $icon | partial "plugin/icon.html" -}}</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
<a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a>
|
||||
</h2>
|
||||
|
||||
{{- /* Meta */ -}}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
{{- if .Params.collections | and $params.collectionList -}}
|
||||
{{- $collectionTerms := .GetTerms "collections" -}}
|
||||
{{- range $collectionTerms -}}
|
||||
{{- $pages := .Pages -}}
|
||||
{{- $prev := cond $.Site.Params.navigationReverse ($pages.Next $) ($pages.Prev $) -}}
|
||||
{{- $next := cond $.Site.Params.navigationReverse ($pages.Prev $) ($pages.Next $) -}}
|
||||
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
|
||||
{{- $open := eq (index $collectionTerms 0) . -}}
|
||||
{{- $currentKey := 0 -}}
|
||||
|
||||
@@ -30,7 +28,7 @@
|
||||
{{- end -}}
|
||||
</ul>
|
||||
<div class="collection-nav-simple">
|
||||
{{- with $prev -}}
|
||||
{{- with $pages.Next $ -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ .LinkTitle }}">
|
||||
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
@@ -38,7 +36,7 @@
|
||||
{{- dict "Class" "fa-solid fa-angle-left fa-fw collection-nav-item text-secondary" | partial "plugin/icon.html" -}}
|
||||
{{- end -}}
|
||||
<span class="text-secondary">{{ add $currentKey 1 }}/{{ $pages.Len }}</span>
|
||||
{{- with $next -}}
|
||||
{{- with $pages.Prev $ -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ .LinkTitle }}">
|
||||
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
|
||||
</a>
|
||||
|
||||
@@ -12,18 +12,17 @@
|
||||
-}}
|
||||
<div class="collection-card">
|
||||
<div class="collection-title text-secondary">
|
||||
{{ dict "Collections" $termLink | T "single.includedIn.collections" | safeHTML }} {{ .Pages.Len }}
|
||||
{{- dict "Collections" $termLink | T "single.includedIn.collections" | safeHTML }} {{ .Pages.Len -}}
|
||||
</div>
|
||||
<div class="collection-nav">
|
||||
{{- $prev := cond $.Site.Params.navigationReverse (.Pages.Next $) (.Pages.Prev $) -}}
|
||||
{{- $next := cond $.Site.Params.navigationReverse (.Pages.Prev $) (.Pages.Next $) -}}
|
||||
{{- with $prev -}}
|
||||
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
|
||||
{{- with $pages.Next $ -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="prev" title="{{ .LinkTitle }}">
|
||||
{{- dict "Class" "fa-solid fa-angle-left fa-fw" | partial "plugin/icon.html" -}}
|
||||
<span>{{- .LinkTitle -}}</span>
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- with $next -}}
|
||||
{{- with $pages.Prev $ -}}
|
||||
<a href="{{ .RelPermalink }}" class="collection-nav-item" rel="next" title="{{ .LinkTitle }}">
|
||||
<span>{{- .LinkTitle -}}</span>
|
||||
{{- dict "Class" "fa-solid fa-angle-right fa-fw" | partial "plugin/icon.html" -}}
|
||||
|
||||
Reference in New Issue
Block a user