hugo-djem-so

Hugo theme for my blog

git clone git://git.shimmy1996.com/hugo-djem-so.git
commit 940be3d29417042e609432ab0f29f09afaaa6d0d
parent f711c65e5c37d0dee9ed4195693cdfe9605c4d28
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sun,  5 Jan 2020 17:27:08 -0600

Let nav change content based on page and add page date display

Diffstat:
Mlayouts/partials/nav.html | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
@@ -1,15 +1,16 @@
 <nav>
-  <a href="{{ .Site.Home.Permalink | relURL }}"><b>{{ .Site.Title }}</b></a>&nbsp;
-  {{- range .Site.Menus.main -}}
-  |&nbsp;<a href="{{ .URL | relURL }}">{{ .Name }}</a>&nbsp;
+  {{ if .IsHome }}
+  {{- range $i, $menu := .Site.Menus.main -}}
+  {{- if (ge $i 1) }}&nbsp;|&nbsp;{{ end -}}
+  <a href="{{ .URL | relURL }}">{{ .Name }}</a>
   {{- end -}}
-  {{- if .IsTranslated -}}
-  <span style="float:right;">&#91;&nbsp;
-    {{- range $i, $page := .Translations -}}
-    {{- if (ge $i 1) }}&nbsp;|&nbsp;{{ end -}}
-    <a href="{{ $page.Permalink | relURL }}">{{ $page.Language.LanguageName }}</a>
-    {{- end -}}
-    &nbsp;&#93;
-  </span>
+  {{- else -}}
+  {{- if not .IsNode -}}{{- with .Date -}}
+  <time datetime={{ .Format "2006-01-02" }}>{{ .Format "2006-01-02" }}</time>&nbsp;|&nbsp;
+  {{- end -}}{{- end -}}
+  <a href="{{ .Site.Home.Permalink | relURL }}">{{ .Site.Title }}</a>
+  {{- end -}}
+  {{- range .Translations -}}
+  &nbsp;|&nbsp;<a href="{{ .Permalink | relURL }}">{{ .Language.LanguageName }}</a>
   {{- end -}}
 </nav>