From f57ac2b8cc8e7192015a3fc672927e9714dd4d3f Mon Sep 17 00:00:00 2001 From: Alex Selimov Date: Fri, 11 Jul 2025 23:14:20 -0400 Subject: [PATCH] Update index page to link to all posts --- exampleSite/config.toml | 53 ++++++++++++++++++++----------------- layouts/_default/index.html | 9 +++---- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 0ed55b2..7dd7cea 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -4,34 +4,37 @@ theme = "hugo-theme-terminal" pagination.pagerSize = 5 [markup.goldmark.renderer] - unsafe = true +unsafe = true [params] - contentTypeName = "posts" - showMenuItems = 2 - fullWidthTheme = false - centerTheme = false +contentTypeName = "posts" +showMenuItems = 2 +postsToShowOnIndex = 3 +fullWidthTheme = false +centerTheme = false [languages] - [languages.en] - title = "Terminal" - subtitle = "A simple, retro theme for Hugo" - keywords = "" - copyright = "" - menuMore = "Show more" - readMore = "Read more" - readOtherPosts = "Read other posts" +[languages.en] +title = "Terminal" +subtitle = "A simple, retro theme for Hugo" +keywords = "" +copyright = "" - [languages.en.params.logo] - logoText = "Terminal" - logoHomeLink = "/" +[languages.en.params] +menuMore = "Show more" +readMore = "Read more" +readOtherPosts = "Read other posts" - [languages.en.menu] - [[languages.en.menu.main]] - identifier = "about" - name = "About" - url = "/about" - [[languages.en.menu.main]] - identifier = "showcase" - name = "Showcase" - url = "/showcase" +[languages.en.params.logo] +logoText = "Terminal" +logoHomeLink = "/" + +[languages.en.menu] +[[languages.en.menu.main]] +identifier = "about" +name = "About" +url = "/about" +[[languages.en.menu.main]] +identifier = "showcase" +name = "Showcase" +url = "/showcase" diff --git a/layouts/_default/index.html b/layouts/_default/index.html index befd23b..418f82a 100644 --- a/layouts/_default/index.html +++ b/layouts/_default/index.html @@ -12,9 +12,7 @@ {{ if .IsHome }} {{ $PageContext = .Site }} {{ end }} - {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} - - {{ range $paginator.Pages }} + {{ range ( where .Site.RegularPages "Type" "posts" | first .Site.Params.postsToShowOnIndex) }}

{{ .Title | markdownify }} @@ -60,7 +58,8 @@ {{ end }}

{{ end }} - - {{ partial "pagination.html" . }} +
+ [Go to all posts] +
{{ end }}