{{ $str := "" }}
<div class="post-nav">
  {{if .NextInSection}}
  {{/* For the Book layout, prev/next labels are reversed. */}}
  {{ if in (slice "docs" "book") .Type }}{{ $str = "previous" }}{{else}}{{ $str = "next" }}{{end}}
  <div class="post-nav-item">
    <div class="meta-nav">{{ i18n $str }}</div>
    <a href="{{.NextInSection.RelPermalink}}" rel="next">{{.NextInSection.Title}}</a>
  </div>
  {{end}}
  {{if .PrevInSection}}
  {{ if in (slice "docs" "book") .Type }}{{ $str = "next" }}{{else}}{{ $str = "previous" }}{{end}}
  <div class="post-nav-item">
    <div class="meta-nav">{{ i18n $str }}</div>
    <a href="{{.PrevInSection.RelPermalink}}" rel="prev">{{.PrevInSection.Title}}</a>
  </div>
  {{end}}
</div>
