My structure in content
:
content
|-post
| |-00.md
| |-01.md
| |-02.md
|-about.md
In the single template for the posts I want to have a footer that:
In Pseudo-template-code that means:
{{ if nextpost.exists }} #. becomes nexpost here
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}
Where nextpost
is currentpost+1
How to create that kind of link?
It sounds like you want the .NextInSection variable. If you use the with function, you can make it work like you want to.
{{ with .NextInSection }}
<a href="{{ .Permalink }}">{{ .Title }}</a>
{{ end }}
You can use .PrevInSection
in a similar way also.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With