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 }}
{{ range .Pages }}
-
diff --git a/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html b/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html
--- a/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html
+++ b/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html
@@ -1,14 +1,3 @@
-{{ $articles := slice}}
-
-{{ range where .Site.Pages "Section" "articles" }}
- {{ with .File }}
- {{ $subDirsNumer := .File.Path | strings.Count "/" }}
- {{ if eq $subDirsNumer 2 }}
- {{ $articles = $articles | append (dict "page" . "path" .File.Path) }}
- {{ end }}
- {{ end }}
-{{ end }}
-
{{ partial "global-search.html" . }}
{{ i18n "articles" }}
@@ -17,25 +6,12 @@
-{{ $articles := slice}}
-
-{{ range where .Site.Pages "Section" "articles" }}
- {{ $subDirsNumer := .File.Path | strings.Count "/" }}
- {{ if eq $subDirsNumer 2 }}
- {{ $articles = $articles | append (dict "page" . "path" .File.Path) }}
- {{ end }}
-{{ end }}
-
diff --git a/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html b/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html
--- a/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html
+++ b/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html
@@ -1,14 +1,3 @@
-{{ $books := slice}}
-
-{{ range where .Site.Pages "Section" "books" }}
- {{ with .File }}
- {{ $subDirsNumer := .File.Path | strings.Count "/" }}
- {{ if eq $subDirsNumer 2 }}
- {{ $books = $books | append (dict "page" . "path" .File.Path) }}
- {{ end }}
- {{ end }}
-{{ end }}
-
{{ partial "global-search.html" . }}
{{ i18n "books" }}
@@ -17,25 +6,13 @@
-{{ $books := slice}}
-
-{{ range where .Site.Pages "Section" "books" }}
- {{ $subDirsNumer := .File.Path | strings.Count "/" }}
- {{ if eq $subDirsNumer 2 }}
- {{ $books = $books | append (dict "page" . "path" .File.Path) }}
- {{ end }}
-{{ end }}
-