diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 16cd8b44..31e1227b 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -40,6 +40,9 @@
{{ $p := . }}
{{ $basePath := path.Clean (urls.Parse .Site.BaseURL).Path }}
+ {{ if eq $basePath "/" }}
+ {{ $basePath = "" }}
+ {{ end }}
{{ range .Site.Menus.main }}
{{ $pagePath := strings.TrimPrefix $basePath $p.RelPermalink }}
{{ $menuPath := strings.TrimPrefix $basePath .URL }}