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
|
- Multilingual mode
|
||||||
- Robots.txt
|
- Robots.txt
|
||||||
- Favorite posts
|
- Favorite posts
|
||||||
|
- Pagination on post single page
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ params:
|
|||||||
customCSS:
|
customCSS:
|
||||||
- css/my.css # relative path to "static" directory
|
- css/my.css # relative path to "static" directory
|
||||||
dateFormat: "2006-01-02"
|
dateFormat: "2006-01-02"
|
||||||
|
paginationSinglePost: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Check your site
|
### Check your site
|
||||||
@ -86,6 +88,9 @@ For production — allow all, for other — disallow all.
|
|||||||
### Favorite posts
|
### Favorite posts
|
||||||
To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title.
|
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
|
## 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).
|
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>
|
</div>
|
||||||
{{ partial "postInfo.html" . }}
|
{{ partial "postInfo.html" . }}
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
{{ if .Site.Params.paginationSinglePost}}
|
||||||
|
{{ partial "paginationPost.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Site.DisqusShortname }}
|
{{ if .Site.DisqusShortname }}
|
||||||
{{ template "_internal/disqus.html" . }}
|
{{ template "_internal/disqus.html" . }}
|
||||||
{{ end }}
|
{{ 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;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-item a:hover, .pagination-item a:focus {
|
.pagination-item a:hover, .pagination-item a:focus {
|
||||||
color: #a31d1d;
|
color: #a31d1d;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-pagination .pagination-item {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
max-width: 16em;
|
||||||
|
}
|
||||||
|
|
||||||
/* Footer */
|
/* Footer */
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
@ -418,4 +425,8 @@ ul.language-select > li {
|
|||||||
header nav a {
|
header nav a {
|
||||||
margin-left: 5%;
|
margin-left: 5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-pagination .pagination-item {
|
||||||
|
max-width: 10em;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user