{{/* 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 }}