2001Y
January 3, 2020, 10:44am
1
I use sessions for categories.
Lists by category (ex. “category1”, “category2”) can be displayed.
However, it is not possible to create an entire list of all “blog”.
Please help me. Also use pagination.
.
/content
/blog ×
/_index.md
/category1 ◯
/_index.md
/2.md
/category2 ◯
/_index.md
/3.md
.
/layouts/blog/list.html
{{ range (.Paginator 5).Pages }}
{{ .Title }}
{{ end }}
{{ partial "pagenation.html" . }}
ju52
January 3, 2020, 1:18pm
2
try this:
{{ $paginator := .Paginate .CurrentSection.RegularPages }}
{{ range $paginator.Pages -}}
{{ .Render "summary" }}
{{- end }}
{{ partial "pagination" . }}
1 Like
2001Y
January 3, 2020, 4:13pm
3
Thank you very much.
But that didn’t help …
2001Y
January 8, 2020, 4:03pm
4
I was able to solve this article a little.
https://noi-labo.com/nested-category-in-hugo/#all-article-list
<!-- layouts/blog/list.html -->
{{$indexScratch := newScratch}}
{{$indexScratch.Set "articleList" .Pages}}
{{ range .Sections.Reverse}}
{{ $indexScratch.Add "articleList" .Pages}}
{{ end }}
{{ $paginator := .Paginate (where ($indexScratch.Get "articleList") "Type" "!=" "page").ByDate.Reverse }}
{{ range $paginator.Pages}}
{{ .Title }}
{{ end }}
{{ $indexScratch.Delete "articleList"}}
{{ partial "pagenation.html" . }}
<!-- content/blog/categoryX/index.md -->
---
title: "カテゴリX"
categories: ["categoryX"]
type: "page"
---
<!-- config.toml -->
paginate = 5