about summary refs log tree commit diff
path: root/layouts/partials/toc.html
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 10:17:49 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 10:19:36 +0700
commitcf91ff39630cead0fad16c16858405b3efbe7994 (patch)
tree3ead000d81c815cdc0fb8403f6a3d7c294cba1eb /layouts/partials/toc.html
parent3f8ec96f3436b1b1a1c91807694280cb08fe7ce9 (diff)
downloadvictor-cf91ff39630cead0fad16c16858405b3efbe7994.tar.gz
Implement table of contents
Diffstat (limited to 'layouts/partials/toc.html')
-rw-r--r--layouts/partials/toc.html11
1 files changed, 8 insertions, 3 deletions
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index 607e7f0..3b5a822 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,4 +1,5 @@
-{{ $chapters := .Page.Pages }}
+{{ $chapters := .content.Page.Pages }}
+{{ $currentLink := .currentLink}}
 {{ range .Page.Translations }}
 {{ $chapters = $chapters | lang.Merge .Pages }}
 {{ end}}
@@ -9,10 +10,14 @@
     {{ with .Params.chapterName }}
       {{ $fullTitle = printf "%s – %s" $fullTitle . }}
     {{ end }}
-    <a href="{{ .RelPermalink }}">{{ trim $fullTitle " " }}</a>
+    {{ if eq $currentLink .RelPermalink }}
+      <a aria-current="page">{{ trim $fullTitle " " }}</a> ({{ i18n "current"}})
+    {{ else }}
+      <a href="{{ .RelPermalink }}">{{ trim $fullTitle " " }}</a>
+    {{ end }}
     {{ partial "post-info.html" . }}
     {{ if .IsSection}}
-      {{ partial "toc.html" . }}
+      {{ partial "toc.html" (dict "content" . "currentLink" $currentLink) }}
     {{ end }}
   </li>
   {{ end }}