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:
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>
- {{- range .Site.Menus.main -}}
- | <a href="{{ .URL | relURL }}">{{ .Name }}</a>
+ {{ if .IsHome }}
+ {{- range $i, $menu := .Site.Menus.main -}}
+ {{- if (ge $i 1) }} | {{ end -}}
+ <a href="{{ .URL | relURL }}">{{ .Name }}</a>
{{- end -}}
- {{- if .IsTranslated -}}
- <span style="float:right;">[
- {{- range $i, $page := .Translations -}}
- {{- if (ge $i 1) }} | {{ end -}}
- <a href="{{ $page.Permalink | relURL }}">{{ $page.Language.LanguageName }}</a>
- {{- end -}}
- ]
- </span>
+ {{- else -}}
+ {{- if not .IsNode -}}{{- with .Date -}}
+ <time datetime={{ .Format "2006-01-02" }}>{{ .Format "2006-01-02" }}</time> |
+ {{- end -}}{{- end -}}
+ <a href="{{ .Site.Home.Permalink | relURL }}">{{ .Site.Title }}</a>
+ {{- end -}}
+ {{- range .Translations -}}
+ | <a href="{{ .Permalink | relURL }}">{{ .Language.LanguageName }}</a>
{{- end -}}
</nav>