fix: make sure we don't output empty h1 tags
For #397 we didn't want to have a title, so we ended up rendering an
empty h1 tag, this makes sure that the h1 tag is rendered only if the
title is provided in the front matter.
diff --git a/layouts/_default/section.html b/layouts/_default/section.html
index 7861680..4cab5f2 100644
--- a/layouts/_default/section.html
+++ b/layouts/_default/section.html
@@ -1,8 +1,10 @@
{{ partial "header.html" . }}
- <article class="static doc {{ .Page.Section }}">
+ <article class="static doc {{ .Page.Section }}">
- <h1>{{ .Title }} </h1>
+ {{ with .Title }}
+ <h1>{{ . }} </h1>
+ {{ end }}
{{ .Content }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 1ddb38a..3065ce7 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -4,7 +4,9 @@
<main role="main">
<article class="static doc {{ .Page.Section }}">
- <h1>{{ .Title }}</h1>
+ {{ with .Title }}
+ <h1>{{ . }} </h1>
+ {{ end }}
{{ .Content }}