Amélioration du menu ls.

Avec notamment l'ajout de l'entrée de la section courante _index.md, et de
l'attribut aria-current quand nécessaire.
This commit is contained in:
2026-03-25 00:47:58 +01:00
parent b8a3d89e03
commit de5d7bb639
3 changed files with 24 additions and 23 deletions
+9 -9
View File
@@ -1,5 +1,7 @@
{{ $page := .page }}
<span aria-hidden="true">{{ cond $page.IsNode "drwxr-xr-x" "-rw-r--r--" }}</span>
<span aria-hidden="true">
{{ cond (and $page.IsNode (not .forceFile)) "drwxr-xr-x" "-rw-r--r--" }}
</span>
<span aria-hidden="true" style="text-align: right">
{{/* Nombre d'éléments dans le nœud, sinon 1 si c'est un fichier. */}}
{{ cond $page.IsNode (len $page.Pages) "1" }}
@@ -24,15 +26,13 @@
{{ end }}
<span>
<a class="{{ with $page.Params.class -}}{{ . }}{{ end }}"
{{ with .currentPage }}
{{ if .Eq $page }}
href=""
{{ else }}
href="{{ $page.RelPermalink }}"
{{ end }}
{{ if and .currentPage (.currentPage.Eq $page) }}
aria-current="page"
href=""
{{ else }}
href="{{ $page.RelPermalink }}"
href="{{ $page.RelPermalink }}"
{{ end }}
title="{{ $page.Title }}">{{ or .linkTitle $page.LinkTitle }}</a>
title="{{ $page.Title }}">{{ or .linkTitle (print
$page.File.BaseFileName "." $page.File.Ext) $page.LinkTitle }}</a>
</span>
{{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}}