diff options
author | mms <michal@sapka.me> | 2024-04-28 00:00:47 +0200 |
---|---|---|
committer | mms <michal@sapka.me> | 2024-04-28 00:00:47 +0200 |
commit | 36b839da7070552549b63e07004c4011eb88e392 (patch) | |
tree | ddbf4a90a14a23f6706df8d5271585d454d896d9 /layouts | |
parent | 2690a1fc2422a6406c44bde16b10aef212927c23 (diff) |
feat: why bsd p1
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/header/header.html | 4 | ||||
-rw-r--r-- | layouts/partials/menu.html | 26 | ||||
-rw-r--r-- | layouts/partials/menu/item.html | 31 | ||||
-rw-r--r-- | layouts/partials/menu/new-or-up.html | 9 |
4 files changed, 45 insertions, 25 deletions
diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index 05e9290..ec4aded 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -1,5 +1,5 @@ <header> - <div class="logo"> + <a href="/" alt="return to homemage" class="logo"> {{ if in .Page.Params.categories "bsd" }} {{ $logo := resources.Get "logos/logo-beastie-white.svg"}} <img src="{{$logo.Permalink}}" class="beastie" alt="FreeBSD"> @@ -20,7 +20,7 @@ <img src="{{$logo.Permalink}}" class="emacslogo" alt="Emacs"> {{ end }} </a> - </div> + </a> <div class="name"> <nav> diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 28421ac..b27d498 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -12,16 +12,8 @@ {{- define "partials/inline/menu/walk.html" }} {{- $page := .page }} {{- range .menuEntries }} - - {{- if .Params.nonpage }} - <li>{{.Name }} {{ .Post }} - {{- else if .Params.placeholder }} - <li><span class="placeholder">{{.Name }} {{ .Post }}</span> - {{- else}} - <li><b><a href="{{ .URL }}">{{ .Name }}</a></b> {{ .Post }} - {{- partial "inline/menu/new-or-up.html" (dict "page" ($page.GetPage .URL)) }} - {{- end}} - + {{- partial "menu/item.html" (dict "page" $page "item" .) }} + {{- if .Params.inlineChildren}} {{- with .Children }} - {{- partial "inline/menu/inline.html" (dict "page" $page "menuEntries" .) }} @@ -31,7 +23,6 @@ {{- with .Children }} <ul>{{- partial "inline/menu/walk.html" (dict "page" $page "menuEntries" .) }}</ul> {{- end }} - </li> {{- end}} {{- end }} {{- end }} @@ -39,18 +30,7 @@ {{- define "partials/inline/menu/inline.html" }} {{- $page := .page }} {{- range .menuEntries }} - <a href="{{ .URL }}"> {{ .Name }}</a>{{- partial "inline/menu/new-or-up.html" (dict "page" ($page.GetPage .URL)) }} + <a href="{{ .URL }}"> {{ .Name }}</a>{{- partial "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) 10 }} -<span class="new">(updated)</span> - {{- end}} -{{- end}} - -{{- end }} diff --git a/layouts/partials/menu/item.html b/layouts/partials/menu/item.html new file mode 100644 index 0000000..599f2db --- /dev/null +++ b/layouts/partials/menu/item.html @@ -0,0 +1,31 @@ +{{- $page := .page }} +{{- $item := .item }} +{{- $pageItem := $page.GetPage $item.URL }} + +{{- if $pageItem.Params.menu_item_override }} + + {{- if $pageItem.Params.menu_item_override_start_li }} + <li> + {{- end}} + + {{$item.Pre}}<b><a href="{{ $item.URL }}">{{ $pageItem.Params.menu_item_override }}</a></b>{{- partial "menu/new-or-up.html" (dict "page" $pageItem) }}{{$item.Post}} + {{- if $pageItem.Params.menu_item_override_end_li }} + </li> + {{- end}} + +{{- else}} + +<li> + {{- if $item.Params.nonpage }} + {{$item.Name }}{{ $item.Post }} + {{- else if $item.Params.placeholder }} + <span class="placeholder">{{$item.Name }}{{ $item.Post }}</span> + {{- else}} + <b><a href="{{ $item.URL }}">{{ $item.Name }}</a></b> + {{- partial "menu/new-or-up.html" (dict "page" $pageItem) }} + {{ $item.Post }} + {{- end}} + +</li> + +{{- end}} diff --git a/layouts/partials/menu/new-or-up.html b/layouts/partials/menu/new-or-up.html new file mode 100644 index 0000000..9eb9a9f --- /dev/null +++ b/layouts/partials/menu/new-or-up.html @@ -0,0 +1,9 @@ +{{- 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) 10 }} + <span class="new">(updated)</span> + {{- end}} + +{{- end}} |