Update index page to link to all posts

This commit is contained in:
Alex Selimov 2025-07-11 23:14:20 -04:00
parent 5a2b4c0f1f
commit f57ac2b8cc
Signed by: aselimov
GPG key ID: 3DDB9C3E023F1F31
2 changed files with 32 additions and 30 deletions

View file

@ -9,6 +9,7 @@ pagination.pagerSize = 5
[params] [params]
contentTypeName = "posts" contentTypeName = "posts"
showMenuItems = 2 showMenuItems = 2
postsToShowOnIndex = 3
fullWidthTheme = false fullWidthTheme = false
centerTheme = false centerTheme = false
@ -18,6 +19,8 @@ pagination.pagerSize = 5
subtitle = "A simple, retro theme for Hugo" subtitle = "A simple, retro theme for Hugo"
keywords = "" keywords = ""
copyright = "" copyright = ""
[languages.en.params]
menuMore = "Show more" menuMore = "Show more"
readMore = "Read more" readMore = "Read more"
readOtherPosts = "Read other posts" readOtherPosts = "Read other posts"

View file

@ -12,9 +12,7 @@
{{ if .IsHome }} {{ if .IsHome }}
{{ $PageContext = .Site }} {{ $PageContext = .Site }}
{{ end }} {{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} {{ range ( where .Site.RegularPages "Type" "posts" | first .Site.Params.postsToShowOnIndex) }}
{{ range $paginator.Pages }}
<article class="post on-list"> <article class="post on-list">
<h2 class="post-title"> <h2 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
@ -60,7 +58,8 @@
{{ end }} {{ end }}
</article> </article>
{{ end }} {{ end }}
<center>
{{ partial "pagination.html" . }} <a href="/posts" class="button inline" >[Go to all posts]</a>
</center>
</div> </div>
{{ end }} {{ end }}