hugo-ataru

Hugo theme with titleless posts and microformats2 support

git clone git://git.shimmy1996.com/hugo-ataru.git
commit 1e9c7eeaa1fedb608c373e00972c9a68e25d856c
parent cab9864bbe7e1be90c201d7e216ae4e58b62b1aa
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Fri, 10 Apr 2020 22:04:10 -0500

Isolate nav section and label home page content with h-card

Diffstat:
Mlayouts/_default/list.html | 26+++++++++++++++-----------
Mlayouts/_default/single.html | 6++++--
Mlayouts/partials/footer.html | 4++--
Alayouts/partials/get_paginator.html | 5+++++
Mlayouts/partials/header.html | 14+-------------
Alayouts/partials/nav_page.html | 12++++++++++++
6 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
@@ -1,25 +1,29 @@
 {{ define "main" }}
+<hr/>
 <main>
+  {{ $pag := partial "get_paginator.html" . }}
+  {{ if (and .IsHome (not $pag.HasPrev)) }}
+  <div class="h-card">
+  <h1>{{ .Title }}</h1>
   {{ .Content }}
-  {{ $pages := .Data.Pages }}
-  {{ if .IsHome }}
-  {{ $pages = (where .Site.RegularPages "Section" "!=" "") }}
+  </div>
+  <hr/>
   {{ end }}
-  {{ $pag := .Paginate $pages 15  }}
-  {{ if $pag.HasPrev }}<a href="{{ $pag.Prev.URL }}">↑</a>{{ else }}↑{{ end }}
-  <span style="float:right">{{ if $pag.HasNext }}<a href="{{ $pag.Next.URL }}">↓</a>{{ else }}↓{{ end }}</span>
   {{ range $pag.Pages }}
-  <hr/>
   <article class="h-entry">
     <header>
-      <a class="u-url" href="{{ .Permalink }}"><time class="dt-published" datetime="{{ .Date }}">{{ .Date }}</time></a>
+      {{ $timestamp := .Date.Format "2006-01-02T15:04:05Z07:00" }}
+      <a class="u-url" href="{{ .Permalink }}"><time class="dt-published" datetime="{{ $timestamp }}">{{ $timestamp }}</time></a>
       - <a class="p-author h-card" href="{{ .Site.Author.url }}">{{ .Site.Author.name }}</a>
-      {{ with .Title }}<h1 class="p-name">{{ . }}</h1>{{ end }}
+      {{ with .Title }}<h2 class="p-name">{{ . }}</h2>{{ end }}
     </header>
+    {{ if eq .Section "posts" }}
     <div class="p-summary">{{ range (findRE "<p>.*</p>" .Content 1) }}{{ (replaceRE "<.p>" "" .) | safeHTML}}{{ end }}</div>
+    {{ else }}
+    <div class="e-content">{{ .Content }}</div>
+    {{ end }}
   </article>
+  <hr/>
   {{ end }}
-  {{ if $pag.HasPrev }}<a href="{{ $pag.Prev.URL }}">↑</a>{{ else }}↑{{ end }}
-  <span style="float:right">{{ if $pag.HasNext }}<a href="{{ $pag.Next.URL }}">↓</a>{{ else }}↓{{ end }}</span>
 </main>
 {{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
@@ -2,11 +2,13 @@
 <hr/>
 <main class="h-entry">
   <header>
-    <a class="u-url" href="{{ .Permalink }}"><time class="dt-published" datetime="{{ .Date }}">{{ .Date }}</time></a>
+    {{ $timestamp := .Date.Format "2006-01-02T15:04:05Z07:00" }}
+    <a class="u-url" href="{{ .Permalink }}"><time class="dt-published" datetime="{{ $timestamp }}">{{ $timestamp }}</time></a>
     - <a class="p-author h-card" href="{{ .Site.Author.url }}">{{ .Site.Author.name }}</a>
     {{ with .Title }}<h1 class="p-name">{{ . }}</h1>{{ end }}
   </header>
   <div class="e-content">{{ .Content }}</div>
+  {{ partial "hyperskip.html" . }}
 </main>
-{{ partial "hyperskip.html" . }}
+<hr/>
 {{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
@@ -1,4 +1,4 @@
-<hr/>
 <footer>
-&copy; {{ .Site.Author.name }}
+  <nav>{{ partial "nav_page.html" . }}</nav>
+  &copy; {{ .Site.Author.name }}
 </footer>
diff --git a/layouts/partials/get_paginator.html b/layouts/partials/get_paginator.html
@@ -0,0 +1,5 @@
+{{ $pages := .Data.Pages }}
+{{ if .IsHome }}
+{{ $pages = (where .Site.RegularPages "Section" "!=" "") }}
+{{ end }}
+{{ return .Paginate $pages.ByDate.Reverse 10 }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
@@ -10,17 +10,5 @@
   {{- range .Translations -}}
   &nbsp;|&nbsp;<a href="{{ .Permalink | relURL }}">{{ .Language.LanguageName }}</a>
   {{- end -}}
+  {{ partial "nav_page.html" . }}
 </nav>
-{{ if .IsHome }}
-<hr/>
-<div class="h-card">
-  <img style="float:right;width:4em;" class="u-photo" src="{{ .Site.Author.logo }}">
-  <a class="p-name u-url u-uid" rel="me" href="{{ .Site.Author.url }}">
-    {{ .Site.Author.name }}
-  </a>
-  <br/>
-  <p><a rel="me" class="u-email" href="mailto:{{ .Site.Author.email }}">
-    {{ .Site.Author.email }}
-  </a></p>
-</div>
-{{ end }}
diff --git a/layouts/partials/nav_page.html b/layouts/partials/nav_page.html
@@ -0,0 +1,12 @@
+{{ if .IsNode }}
+{{ $pag := partial "get_paginator.html" . }}
+<span style="float:right">
+  {{ if $pag.HasPrev }}<a href="{{ $pag.Prev.URL }}">↑</a>{{ else }}↑{{ end }}
+  {{ if $pag.HasNext }}<a href="{{ $pag.Next.URL }}">↓</a>{{ else }}↓{{ end }}
+</span>
+{{ else }}
+<span style="float:right">
+  {{with .Site.RegularPages.Next . }}<a href="{{ .RelPermalink }}">↑</a>{{ else }}↑{{end}}
+  {{with .Site.RegularPages.Prev . }}<a href="{{ .RelPermalink }}">↓</a>{{ else }}↓{{end}}
+</span>
+{{ end }}