diff options
author | mms <michal@sapka.me> | 2024-04-09 20:22:22 +0200 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-04-09 20:22:22 +0200 |
commit | 1e50176c4689bf5c14e98356b0604af1abde81c1 (patch) | |
tree | 23de9b45257c9e88420841b60b455ef90eaa3d3a /layouts/partials/menu.html | |
parent | 21c58932357c5706a2764e0f89e86435d4f8b1ec (diff) |
feat: mark new on hp
Diffstat (limited to 'layouts/partials/menu.html')
-rw-r--r-- | layouts/partials/menu.html | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index b88272b..5a2c91f 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -13,13 +13,13 @@ {{- $page := .page }} {{- range .menuEntries }} - {{- if .Params.nonpage }} <li>{{.Name }} {{- else if .Params.placeholder }} <li class="placeholder">{{.Name }} {{- else}} <li><b><a href="{{ .URL }}">{{ .Name }}</a></b> + {{- partial "inline/menu/new-or-up.html" (dict "page" ($page.GetPage .URL)) }} {{- end}} {{- if .Params.inlineChildren}} @@ -38,7 +38,19 @@ {{- define "partials/inline/menu/inline.html" }} {{- $page := .page }} - {{- range .menuEntries }} - <a href="{{ .URL }}"> {{ .Name }}</a>, + {{- range .menuEntries }} + <a href="{{ .URL }}"> {{ .Name }}</a>{{- partial "inline/menu/new-or-up.html" (dict "page" ($page.GetPage .URL)) }} {{- end }} {{- end }} + +{{- define "partials/inline/menu/new-or-up.html" }} + +{{- if lt (div (now.Sub .page.PublishDate).Hours 24) 15}} +<span class="new">(new)</span> +{{- else}} + {{if lt (div (now.Sub .page.Lastmod).Hours 24) 15}} +<!-- <span class="new">(updated)</span> --> + {{- end}} +{{- end}} + +{{- end }} |