Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/monkeyWzr/hugo-theme-cactus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGo <monkeywzr@gmail.com>2021-07-05 12:38:25 +0300
committerGitHub <noreply@github.com>2021-07-05 12:38:25 +0300
commitb0411f6976954fc46962410aee7e1e3ec748bcc1 (patch)
tree4647013e8ba145cd6f665b67cff8870c9619a0a2
parent53e9abe9a12ab5e9ed2483b6c6ba1fcfc4d536f0 (diff)
parentfaf1807ad39b6617933725ff96948dd67e4d1711 (diff)
Merge pull request #9 from Nizzlay/disable-pagination
Create option to disable pagination in archive
-rw-r--r--README.md10
-rw-r--r--exampleSite/config.toml1
-rw-r--r--layouts/_default/list.html12
3 files changed, 20 insertions, 3 deletions
diff --git a/README.md b/README.md
index ffc697e..451fd51 100644
--- a/README.md
+++ b/README.md
@@ -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