Closed griestopf closed 8 years ago
Hello @griestopf,
for all menu links I used the absURL
template function to make all urls absolute by taking the baseurl into account. But the template function seems to have a bug. I've tested it with relURL
that makes the menu links relative to the base url. Now, the subdir from which you're serving the site is respected.
Just pull the latest changes.
@digitalcraftsman I have the same or a similar issue. I used a baseUrl with a subdirectory and the menu no longer rendered. This line in nav_link.html
{{ $isCurrent := eq .Permalink ($currentMenuEntry.URL | absURL | printf "%s") }}
sets $isCurrent to false on the main page when it should be true. This is because $currentMenuEntry.URL | absURL = "example.com" while .Permalink ="example.com\subdirectory"
Please help - how can I fix it? Thanks!
(Also, when using a subdirectory the main content on the main page wouldn't render until I added "type: index", not sure if that is related.)
Changing that line from:
{{ $isCurrent := eq .Permalink ($currentMenuEntry.URL | absURL | printf "%s") }}
to:
{{ $isCurrent := eq .URL ($currentMenuEntry.URL | relURL | printf "%s") }}
Fixes it.
If you specify the following in your config.toml:
and at the same time specify a menu entry pointing to the top level as shown in the "material" demo
and start
hugo server
your content will be served tohttp://localhost/subdir
. However, the menu item created with the above[[menu.main]]
section points tohttp://localhost/
(without subdir), where the hugo server just finds a 404.I tried with
url = "."
. This got around the 404 but the menu item is not populated with the level2 headlines from the root's index.md.Any idea?