Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable pagination #1

Merged
merged 6 commits into from
Oct 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ for example, `data/projects.json`:
}
```

## Social media links
### Social media links

```toml
[[params.social]]
Expand Down Expand Up @@ -245,6 +245,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
Expand Down
1 change: 1 addition & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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."
Expand Down
12 changes: 10 additions & 2 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -17,6 +23,8 @@ <h2>{{ $pageYear }}</h2>
</li>
{{ end }}
</ul>
{{ partial "pagination.html" . }}
{{ if eq .Site.Params.showAllPostsArchive false }}
{{ partial "pagination.html" . }}
{{ end }}
</div>
{{ end }}