diff --git a/documentation/themes/beastie/layouts/partials/menu.html b/documentation/themes/beastie/layouts/partials/menu.html --- a/documentation/themes/beastie/layouts/partials/menu.html +++ b/documentation/themes/beastie/layouts/partials/menu.html @@ -1,4 +1,12 @@ -{{ with .Site.GetPage .Params.path }} +{{/* always extract the first part of the path to match it only with the main document/book. */}} +{{ $path := "" }} +{{ $regex := `^(\/[^\/]+\/[^\/]+)` }} +{{ $matches := findRE $regex .Params.path }} +{{ if gt (len $matches) 0 }} + {{ $path = index $matches 0 }} +{{ end }} + +{{ with .Site.GetPage $path }}