From 1e50176c4689bf5c14e98356b0604af1abde81c1 Mon Sep 17 00:00:00 2001 From: mms Date: Tue, 9 Apr 2024 20:22:22 +0200 Subject: feat: mark new on hp --- layouts/partials/menu.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'layouts/partials/menu.html') 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 }}
  • {{.Name }} {{- else if .Params.placeholder }}
  • {{.Name }} {{- else}}
  • {{ .Name }} + {{- 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 }} - {{ .Name }}, + {{- range .menuEntries }} + {{ .Name }}{{- 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}} +(new) +{{- else}} + {{if lt (div (now.Sub .page.Lastmod).Hours 24) 15}} + + {{- end}} +{{- end}} + +{{- end }} -- cgit v1.2.3