{{ $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 }} {{ $active := or (and (eq $menuPath `/`) (eq $pagePath `/`)) (and (ne $menuPath `/`) (hasPrefix $pagePath $menuPath)) }}
  • {{ .Name }}
  • {{ end }}