diff options
-rw-r--r-- | content/canory/messages/pinned.md | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/likes.html | 30 |
2 files changed, 13 insertions, 19 deletions
diff --git a/content/canory/messages/pinned.md b/content/canory/messages/pinned.md index d00fb1b..1e1bd16 100644 --- a/content/canory/messages/pinned.md +++ b/content/canory/messages/pinned.md @@ -3,7 +3,7 @@ date = "2022-02-05T02:20:51+00:00" lastmod = "2022-03-29T22:55:17+00:00" tags = [ "docs", "pinned", "hugo" ] weight = 1 -liked = 1 +liked = true author = "canory" +++ diff --git a/themes/default/layouts/_default/likes.html b/themes/default/layouts/_default/likes.html index f1819b4..f37159c 100644 --- a/themes/default/layouts/_default/likes.html +++ b/themes/default/layouts/_default/likes.html @@ -31,24 +31,18 @@ {{ partial "profile.html" . }} - {{ $author := partial "author-user.html" . }} - {{ $count := 0 }} - {{ $result := false }} - - {{ range .Site.Pages }} - {{ if and (eq .Type $author) .Params.Liked }} - {{ $result = true }} - {{ $count = add $count 1 }} - {{ if le $count 10 }} - {{ .Render "summary" }} - {{ end }} - {{ end }} - {{ end }} - - {{ if not $result }} - <footer> - <code>No likes found!</code> - </footer> + {{- $author := partial "author-user.html" . -}} + {{- $users := where .Site.RegularPages "Section" $author -}} + {{- $likes := where .Site.RegularPages ".Params.liked" true -}} + {{- $filteredPages := $users | intersect $likes -}} + {{- $paginator := .Paginate $filteredPages }} + + {{ range $paginator.Pages }} + {{ .Render "summary" }} + {{ else }} + <footer> + <code>No likes found!</code> + </footer> {{ end }} {{ partial "pagination.html" . }} |