Main Menu url being re-written incorrectly

Maybe I’m wrong… quite a fresher and not yet done many things with languages and menus/navigation but taking the chance to learn…

I think the Problem is in docsy/layouts/partials/navbar.html at main · google/docsy · GitHub

  1. secondary problem in line 5 : {{ $baseURL := urls.Parse $.Site.Params.Baseurl -}}

    this is empty and later used for testing if it is an external site → the only reason why your url for MPages is treated as external because “” differs from any valid baseurl (line 38)

  2. main problem in lines 32-36

  • your MPages is not a page of your site

  • so the else is triggered

  • with will return the relLangURL

    • which will strip off the domain Part cause it’s the same as sites BaseUrl
         {{ with .Page -}}
           {{ $active = or $active ( $.IsDescendant .) -}}
           {{ $href = .RelPermalink -}}
         {{ else -}}
           {{ $href = .URL | relLangURL -}}
         {{ end -}}
    

tested with an ootb docsy with your config snippets (which fe. lacks the language and maybe other settings) so there might be a choice for me to fail.

2 Likes