Skip to content

Commit

Permalink
🐛 Fix: collection nav and list can not show in posts that have password
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Jul 11, 2024
1 parent 6d9c6f5 commit 2b2bde7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions layouts/partials/single/collection-list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{{- /* Collection List */ -}}
{{- $params := partial "function/params.html" -}}

{{- if .Params.collections | and $params.collectionList | and (not $params.password) -}}
{{- if .Params.collections | and $params.collectionList -}}
{{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}}
{{- $pages := (where .Pages "Params.Weight" "!=" nil) | append (where .Pages "Params.Weight" "eq" nil).ByDate -}}
{{- $open := eq (index $collectionTerms 0) . -}}
{{- $currentKey := 0 -}}

<div class="details collection-details{{ if $open }} open{{ end }}">
<div class="details collection-details{{ with $params.password }} encrypted-hidden{{ end }}{{ if $open }} open{{ end }}">
<div class="details-summary collection-summary">
{{ dict "Class" "fa-solid fa-layer-group fa-fw" | partial "plugin/icon.html" }}
<span class="collection-name" data-collections="{{ T "collections" }}">{{ .LinkTitle }}</span>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/single/collection-nav.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- /* Collection Navigation */ -}}
{{- $params := partial "function/params.html" -}}

{{- if .Params.collections | and $params.collectionNavigation | and (not $params.password) -}}
{{- if .Params.collections | and $params.collectionNavigation -}}
{{- $collectionTerms := .GetTerms "collections" -}}
{{- range $collectionTerms -}}
{{- $termLink := printf `<a href="%v">%v <span>%v・%v</span></span></a>`
Expand All @@ -10,7 +10,7 @@
(T "collection")
.LinkTitle
-}}
<div class="collection-card">
<div class="collection-card{{ with $params.password }} encrypted-hidden{{ end }}">
<div class="collection-title text-secondary">
{{- dict "Collections" $termLink | T "single.includedIn.collections" | strings.FirstUpper | safeHTML }} {{ .Pages.Len -}}
</div>
Expand Down

0 comments on commit 2b2bde7

Please sign in to comment.