diff --git a/documentation/themes/beastie/layouts/partials/menu.html b/documentation/themes/beastie/layouts/partials/menu.html index 1b3ddf3b7d..e189abad53 100644 --- a/documentation/themes/beastie/layouts/partials/menu.html +++ b/documentation/themes/beastie/layouts/partials/menu.html @@ -1,35 +1,43 @@ -{{ 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 }} {{ end }} diff --git a/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html b/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html index 843300d4aa..33eab8f495 100644 --- a/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html +++ b/documentation/themes/beastie/layouts/shortcodes/list-articles-directories.html @@ -1,41 +1,17 @@ -{{ $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" }}

{{ i18n "list-desc-articles" }}


-{{ $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 index 10df5da34c..d98353f942 100644 --- a/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html +++ b/documentation/themes/beastie/layouts/shortcodes/list-books-directories.html @@ -1,41 +1,18 @@ -{{ $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" }}

{{ i18n "list-desc-books" }}


-{{ $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 }} -