hugo-ataru

Hugo theme with titleless posts and microformats2 support

git clone git://git.shimmy1996.com/hugo-ataru.git
commit c41969fee705c796ff68bec9bb20f5af5ee444cb
parent 558392bfa7b1e325e32b2e38a03b3cd9e090d7ab
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sun, 12 Apr 2020 21:37:12 -0500

Use summary or content as title for title-less pages

Diffstat:
Mlayouts/_default/single.html | 3++-
Mlayouts/partials/head.html | 2+-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
@@ -1,7 +1,8 @@
 {{ define "main" }}
 <main class="h-entry">
   {{ partial "header.html" . }}
-  <div class="e-content">{{ .Content }}</div>
+  {{ if .Title }}<div class="e-content">{{ else }}<div class="e-content p-name">{{ end }}
+  {{ .Content }}</div>
   {{ partial "hyperskip.html" . }}
 </main>
 {{ end }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
@@ -29,5 +29,5 @@
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   {{ partial "head_custom.html" . }}
-  <title>{{ .Title }}</title>
+  <title>{{ with .Title }}{{ . }}{{ else }}{{ .Summary }}…{{ end }}&nbsp;|&nbsp;{{ .Site.Title }}</title>
 </head>