aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2023-08-25 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2023-08-25 00:00:00 +0000
commit6e9cc2a184805f6b3de073e4e96986c1f7d6e427c7baae9220313fde34b7dc0f (patch)
tree9fed9640e3847be8149a4bbf7d7a36e4869bc6698bfe0845a91fa86f22147f45
parent67d60bba76e2d2678b5096164468deff70991985ca451ad6ae866d3590a3f363 (diff)
Correctly handle absent navlinks
-rw-r--r--layouts/index.gmi8
-rw-r--r--layouts/index.html2
2 files changed, 8 insertions, 2 deletions
diff --git a/layouts/index.gmi b/layouts/index.gmi
index 1b66945..a15154c 100644
--- a/layouts/index.gmi
+++ b/layouts/index.gmi
@@ -3,13 +3,17 @@
{{ .Site.Params.indexIntro | safeHTML }}
+{{- if .Site.Menus.main }}
+
## {{ i18n "navLinks" }}
+{{ range .Site.Menus.main }}
+=> {{ .URL }} {{ emojify ":link:" | safeHTML }} {{ .Name | safeHTML -}}
+{{ end -}}
-{{ range .Site.Menus.main -}}
-=> {{ .URL }} {{ emojify ":link:" | safeHTML }} {{ .Name | safeHTML }}
{{ end }}
+
## {{ i18n "journalEntries" -}}
{{ range (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }}
diff --git a/layouts/index.html b/layouts/index.html
index d49b710..f2e757c 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -2,6 +2,7 @@
<main>
<h1>{{ .Site.Params.indexTitle }}</h1>
<p>{{ .Site.Params.indexIntro }}</p>
+ {{ if .Site.Menus.main -}}
<h2>{{ i18n "navLinks" }}</h2>
<nav>
<ul class="list">
@@ -10,6 +11,7 @@
{{- end }}
</ul>
</nav>
+ {{ end -}}
<h2>{{ i18n "journalEntries" }}</h2>
{{ range (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse -}}
{{ partial "metadata.html" . }}