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
+2 -6
View File
@@ -1,14 +1,10 @@
{{ partial "breadcrumb.html" . }}
{{ partial "lsmenu.html" (cond .IsNode . .CurrentSection) }}
{{ partial "lsmenu.html" . }}
<div class="cmdblock">
<p aria-hidden="true" class="prompt">
{{ if .IsNode }}
sommaire .
{{ else }}
cat {{ .LinkTitle }}
{{ end }}
cat {{ path.Base . }}
</p>
</div>
{{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}}
+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: */}}
+13 -8
View File
@@ -11,19 +11,24 @@
{{/* La commande ls affiche total en Kio. */}}
<p aria-hidden="true">total {{ math.Floor (div $sum 1024) }}</p>
<ul class="lsresult">
<li class="directory">{{ partial "lsline.html" (dict "page" . "linkTitle" ".") }}</li>
<li class="directory">{{ partial "lsline.html" (dict "page" (or .Parent .) "linkTitle" "..") }}</li>
{{ range .Sections.ByLastmod.Reverse }}
<li class="directory">
{{ partial "lsline.html" (dict "page" .CurrentSection "linkTitle" "." "currentPage" $page) }}
</li>
<li class="directory">
{{ partial "lsline.html" (dict "page" (or .Parent .CurrentSection) "linkTitle" ".." "currentPage" $page) }}
</li>
{{ range .CurrentSection.Sections.ByLastmod.Reverse }}
<li class="directory">
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle) }}
{{ partial "lsline.html" (dict "page" . "linkTitle" .File.ContentBaseName "currentPage" $page ) }}
</li>
{{ end }}
{{ range .Pages.ByPublishDate.Reverse }}
{{ if .IsPage }}
<li class="file" aria-hidden="true">
{{ partial "lsline.html" (dict "page" .CurrentSection "forceFile" true "linkTitle" (path.Base .CurrentSection) "currentPage" $page) }}
</li>
{{ range .CurrentSection.RegularPages.ByPublishDate.Reverse }}
<li class="file">
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle "currentPage" $page) }}
{{ partial "lsline.html" (dict "page" . "linkTitle" .File.LogicalName "currentPage" $page) }}
</li>
{{ end }}
{{ end }}
</ul>
</nav>