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 "breadcrumb.html" . }}
{{ partial "lsmenu.html" (cond .IsNode . .CurrentSection) }} {{ partial "lsmenu.html" . }}
<div class="cmdblock"> <div class="cmdblock">
<p aria-hidden="true" class="prompt"> <p aria-hidden="true" class="prompt">
{{ if .IsNode }} cat {{ path.Base . }}
sommaire .
{{ else }}
cat {{ .LinkTitle }}
{{ end }}
</p> </p>
</div> </div>
{{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}} {{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}}
+7 -7
View File
@@ -1,5 +1,7 @@
{{ $page := .page }} {{ $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"> <span aria-hidden="true" style="text-align: right">
{{/* Nombre d'éléments dans le nœud, sinon 1 si c'est un fichier. */}} {{/* Nombre d'éléments dans le nœud, sinon 1 si c'est un fichier. */}}
{{ cond $page.IsNode (len $page.Pages) "1" }} {{ cond $page.IsNode (len $page.Pages) "1" }}
@@ -24,15 +26,13 @@
{{ end }} {{ end }}
<span> <span>
<a class="{{ with $page.Params.class -}}{{ . }}{{ end }}" <a class="{{ with $page.Params.class -}}{{ . }}{{ end }}"
{{ with .currentPage }} {{ if and .currentPage (.currentPage.Eq $page) }}
{{ if .Eq $page }} aria-current="page"
href="" href=""
{{ else }} {{ else }}
href="{{ $page.RelPermalink }}" href="{{ $page.RelPermalink }}"
{{ end }} {{ end }}
{{ else }} title="{{ $page.Title }}">{{ or .linkTitle (print
href="{{ $page.RelPermalink }}" $page.File.BaseFileName "." $page.File.Ext) $page.LinkTitle }}</a>
{{ end }}
title="{{ $page.Title }}">{{ or .linkTitle $page.LinkTitle }}</a>
</span> </span>
{{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}} {{/* vim: set tw=80 ts=2 sw=2 sts=2 ft=gohtmltmpl: */}}
+13 -8
View File
@@ -11,20 +11,25 @@
{{/* La commande ls affiche total en Kio. */}} {{/* La commande ls affiche total en Kio. */}}
<p aria-hidden="true">total {{ math.Floor (div $sum 1024) }}</p> <p aria-hidden="true">total {{ math.Floor (div $sum 1024) }}</p>
<ul class="lsresult"> <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"> <li class="directory">
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle) }} {{ 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" .File.ContentBaseName "currentPage" $page ) }}
</li> </li>
{{ end }} {{ end }}
{{ range .Pages.ByPublishDate.Reverse }} <li class="file" aria-hidden="true">
{{ if .IsPage }} {{ partial "lsline.html" (dict "page" .CurrentSection "forceFile" true "linkTitle" (path.Base .CurrentSection) "currentPage" $page) }}
</li>
{{ range .CurrentSection.RegularPages.ByPublishDate.Reverse }}
<li class="file"> <li class="file">
{{ partial "lsline.html" (dict "page" . "linkTitle" .LinkTitle "currentPage" $page) }} {{ partial "lsline.html" (dict "page" . "linkTitle" .File.LogicalName "currentPage" $page) }}
</li> </li>
{{ end }} {{ end }}
{{ end }}
</ul> </ul>
</nav> </nav>
</div> </div>