Explorar o código

feat(docs): add section pager

George Cushen %!s(int64=6) %!d(string=hai) anos
pai
achega
1e9bcd1dcb
Modificáronse 2 ficheiros con 12 adicións e 4 borrados
  1. 4 0
      layouts/partials/docs_layout.html
  2. 8 4
      layouts/partials/section_pager.html

+ 4 - 0
layouts/partials/docs_layout.html

@@ -36,6 +36,10 @@
           </div>
 
           {{ partial "tags.html" . }}
+
+          <div class="article-widget">
+            {{ partial "section_pager.html" . }}
+          </div>
         </div>
 
         <div class="body-footer">

+ 8 - 4
layouts/partials/section_pager.html

@@ -1,14 +1,18 @@
+{{ $str := "" }}
 <div class="post-nav">
   {{if .NextInSection}}
+  {{/* For the docs layout, prev/next labels are reversed. */}}
+  {{ if eq .Type "docs" }}{{ $str = "previous" }}{{else}}{{ $str = "next" }}{{end}}
   <div class="post-nav-item">
-    <div class="meta-nav">{{ i18n "next" }}</div>
-    <a href="{{.NextInSection.Permalink}}" rel="next">{{.NextInSection.Title}}</a>
+    <div class="meta-nav">{{ i18n $str }}</div>
+    <a href="{{.NextInSection.RelPermalink}}" rel="next">{{.NextInSection.Title}}</a>
   </div>
   {{end}}
   {{if .PrevInSection}}
+  {{ if eq .Type "docs" }}{{ $str = "next" }}{{else}}{{ $str = "previous" }}{{end}}
   <div class="post-nav-item">
-    <div class="meta-nav">{{ i18n "previous" }}</div>
-    <a href="{{.PrevInSection.Permalink}}" rel="prev">{{.PrevInSection.Title}}</a>
+    <div class="meta-nav">{{ i18n $str }}</div>
+    <a href="{{.PrevInSection.RelPermalink}}" rel="prev">{{.PrevInSection.Title}}</a>
   </div>
   {{end}}
 </div>