Skip to content

Commit 9abe0e9

Browse files
committed
update book menu
1 parent b031c66 commit 9abe0e9

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

layouts/partials/book-menu-filetree.html

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
{{ $bookSection = "/" }}{{/* Backward compatibility */}}
44
{{ end }}
55

6-
{{ $dirs := (split .CurrentSection.File.Dir "/") }}
6+
{{ $dirs := (split .CurrentSection.RelPermalink "/") }}
77
{{ $dir := "" }}
8-
{{ if and (gt (len $dirs) 1) (ne (index $dirs 0) "posts") }}
9-
{{ $dir = (index $dirs 0) }}
10-
{{ else if and (gt (len $dirs) 2) (eq (index $dirs 0) "posts" ) }}
8+
{{ if and (gt (len $dirs) 2) (ne (index $dirs 1) "posts") }}
119
{{ $dir = (index $dirs 1) }}
10+
{{ else if and (gt (len $dirs) 3) (eq (index $dirs 1) "posts" ) }}
11+
{{ $dir = (index $dirs 2) }}
1212
{{ end }}
13-
{{ with .Site.GetPage $bookSection $dir }}
14-
{{ template "book-section-children" (dict "Section" . "CurrentPage" $) }}
15-
{{ end }}
16-
1713
{{ define "book-section-children" }}{{/* (dict "Section" .Section "CurrentPage" .CurrentPage) */}}
1814
<ul>
1915
{{ range (where .Section.Pages "Params.bookhidden" "ne" true) }}

0 commit comments

Comments
 (0)