{% import ( "strings" "net/http" "path" ) %} {% func Header(r *http.Request, navItems []NavItem, title string) %} {%code prefix := "/vmalert/" if strings.HasPrefix(r.URL.Path, prefix) { prefix = "" } %} vmalert{% if title != "" %} - {%s title %}{% endif %} {%= printNavItems(r, title, navItems) %}
{% endfunc %} {% code type NavItem struct { Name string Url string } %} {% func printNavItems(r *http.Request, current string, items []NavItem) %} {%code prefix := "/vmalert/" if strings.HasPrefix(r.URL.Path, prefix) { prefix = "" } %} {% endfunc %}