Add pagination for post single page. Close #22
This commit is contained in:
parent
9ea38661fb
commit
899d9fd52d
@ -17,6 +17,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
|
||||
- Multilingual mode
|
||||
- Robots.txt
|
||||
- Favorite posts
|
||||
- Pagination on post single page
|
||||
|
||||
## Installation
|
||||
|
||||
@ -59,6 +60,7 @@ params:
|
||||
customCSS:
|
||||
- css/my.css # relative path to "static" directory
|
||||
dateFormat: "2006-01-02"
|
||||
paginationSinglePost: true
|
||||
```
|
||||
|
||||
### Check your site
|
||||
@ -86,6 +88,9 @@ For production — allow all, for other — disallow all.
|
||||
### Favorite posts
|
||||
To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title.
|
||||
|
||||
### Pagination on post single page
|
||||
Enabled by `paginationSinglePost` param in `params` section of config.
|
||||
|
||||
## Contributing
|
||||
|
||||
If you find a bug or have an idea for a feature, feel free to write an [issue](https://github.com/mitrichius/hugo-theme-anubis/issues).
|
||||
|
@ -9,6 +9,11 @@
|
||||
</div>
|
||||
{{ partial "postInfo.html" . }}
|
||||
</article>
|
||||
|
||||
{{ if .Site.Params.paginationSinglePost}}
|
||||
{{ partial "paginationPost.html" . }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.DisqusShortname }}
|
||||
{{ template "_internal/disqus.html" . }}
|
||||
{{ end }}
|
||||
|
14
layouts/partials/paginationPost.html
Normal file
14
layouts/partials/paginationPost.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{ if or ( .PrevInSection ) ( .NextInSection ) }}
|
||||
<div class="pagination post-pagination">
|
||||
<div class="left pagination-item {{ if not .PrevInSection }}disabled{{ end }}">
|
||||
{{ if .PrevInSection }}
|
||||
<a href="{{ .PrevInSection.Permalink | relLangURL }}">{{ .PrevInSection.Title }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="right pagination-item {{ if not .NextInSection }}disabled{{ end }}">
|
||||
{{ if .NextInSection }}
|
||||
<a href="{{ .NextInSection.Permalink | relLangURL }}">{{ .NextInSection.Title }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
@ -351,11 +351,18 @@ article img {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.pagination-item a:hover, .pagination-item a:focus {
|
||||
.pagination-item a:hover, .pagination-item a:focus {
|
||||
color: #a31d1d;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.post-pagination .pagination-item {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 16em;
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
|
||||
footer {
|
||||
@ -418,4 +425,8 @@ ul.language-select > li {
|
||||
header nav a {
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
.post-pagination .pagination-item {
|
||||
max-width: 10em;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user