blog

My blog at www.shimmy1996.com

git clone git://git.shimmy1996.com/blog.git
commit 83c12bb9899bc3ddd32377717a0c2548d764f116
parent 56e37024e6a09c280f48ace8f086ec72caff977b
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sun,  3 May 2020 13:13:45 -0500

Add a nav region for posts page with titles and anchor links

Diffstat:
Alayouts/_default/list.html | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -0,0 +1,29 @@
+{{ define "main" }}
+<nav>{{ partial "nav_page.html" . }}</nav>
+<nav>
+  {{- range $i, $menu := .Site.Menus.main -}}
+  {{- if (ge $i 1) }}&nbsp;|&nbsp;{{ end -}}
+  <a href="{{ .URL | relURL }}">{{ .Name }}</a>
+  {{- end -}}
+  {{ partial "language.html" . }}
+</nav>
+<main class="h-feed">
+  {{ $pag := partial "get_paginator.html" . }}
+  {{ if (not $pag.HasPrev) }}
+  {{ .Content }}
+  {{ end }}
+  {{ if eq .Section "posts" }}
+  <nav><ul>
+  {{ range $pag.Pages.ByDate }}
+  <li><a href="#{{ .Date.Format "2006-01-02T15-04-05Z07-00"}}">{{ .Title }}</a></li>
+  {{ end }}
+  </ul></nav>
+  {{ end }}
+  {{ range $pag.Pages.ByDate }}
+  <div class="h-entry" id="{{ .Date.Format "2006-01-02T15-04-05Z07-00"}}">
+    {{ partial "header.html" . }}
+    <div class="e-content">{{ .Content }}</div>
+  </div>
+  {{ end }}
+</main>
+{{ end }}