diff options
author | Go <monkeywzr@gmail.com> | 2021-07-05 12:38:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-05 12:38:25 +0300 |
commit | b0411f6976954fc46962410aee7e1e3ec748bcc1 (patch) | |
tree | 4647013e8ba145cd6f665b67cff8870c9619a0a2 | |
parent | 53e9abe9a12ab5e9ed2483b6c6ba1fcfc4d536f0 (diff) | |
parent | faf1807ad39b6617933725ff96948dd67e4d1711 (diff) |
Merge pull request #9 from Nizzlay/disable-pagination
Create option to disable pagination in archive
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/_default/list.html | 12 |
3 files changed, 20 insertions, 3 deletions
@@ -151,7 +151,7 @@ for example, `data/projects.json`: } ``` -## Social media links +### Social media links ```toml [[params.social]] @@ -262,6 +262,14 @@ mathjax: true # or false The site config will be ignored when `mathjax` option exists in front matter. +### Archive +Pagination on posts archive can be disabled to show all posts in chronological order + +```toml +[params] + showAllPostsArchive = true # or false (default) +``` + ## TODOS - [ ] More comments engines diff --git a/exampleSite/config.toml b/exampleSite/config.toml index dd0e4ef..97b3c21 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -51,6 +51,7 @@ weight = 4 colortheme = "white" # dark, light, white, or classic rss = true # generate rss feed. default value is false googleAnalyticsAsync = true # use asynchronous tracking. Synchronous tracking by default + showAllPostsArchive = false # default # Home page settings description = "Hugo is a general-purpose website framework. Technically speaking, Hugo is a static site generator. Unlike systems that dynamically build a page with each visitor request, Hugo builds pages when you create or update your content. Since websites are viewed far more often than they are edited, Hugo is designed to provide an optimal viewing experience for your website’s end users and an ideal writing experience for website authors." diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e674a11..e8c3e31 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,7 +1,13 @@ {{ define "main"}} <div id="archive"> <ul class="post-list"> - {{ range (sort .Paginator.Pages "Date" "desc") }} + + {{ $pages := .Paginator.Pages }} + {{ if .Site.Params.showAllPostsArchive }} + {{ $pages = .Pages }} + {{ end }} + + {{ range (sort $pages "Date" "desc") }} {{ $pageYear := (.Date.Format "2006") }} {{ if (ne $pageYear ($.Scratch.Get "year")) }} {{ $.Scratch.Set "year" $pageYear }} @@ -17,6 +23,8 @@ </li> {{ end }} </ul> - {{ partial "pagination.html" . }} + {{ if eq .Site.Params.showAllPostsArchive false }} + {{ partial "pagination.html" . }} + {{ end }} </div> {{ end }}
\ No newline at end of file |