diff options
Diffstat (limited to '')
-rw-r--r-- | assets/header.css | 8 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/nav.html | 17 |
3 files changed, 24 insertions, 3 deletions
diff --git a/assets/header.css b/assets/header.css index 4904b64..9831912 100644 --- a/assets/header.css +++ b/assets/header.css @@ -28,4 +28,12 @@ header nav ul li a:hover { float: left; text-transform: uppercase; font-weight: 700; + margin-right: 4px; +} +.nav-menu-margin-left { + margin-left: 4px; +} +.nav-menu-margins-left-and-right { + margin-left: 4px; + margin-right: 4px; } diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 07920c1..5faf4e4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -23,7 +23,7 @@ {{ end -}} <title>{{ $title }}</title> - <meta name="description" content=""> + <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}"> </head> <body> {{- partial "nav.html" . -}} diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index 109f687..eeec5f2 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -3,14 +3,27 @@ <ul> <li class="nav-menu-title"><a href="/">{{ .Site.Title }}</a></li> {{- $p := . -}} - {{- range .Site.Menus.main.ByWeight -}} + + {{- range first 1 .Site.Menus.main.ByWeight -}} {{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} {{- with .Page -}} {{- $active = or $active ( $.IsDescendant .) -}} {{- end -}} {{- $url := urls.Parse .URL -}} {{- $baseurl := urls.Parse $.Site.Params.Baseurl -}} - <li{{if $active }} class="nav-menu-active"{{end}}> + <li class="nav-menu-margin-left{{if $active }} nav-menu-active{{end}}"> + <a href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a> + </li> + {{ end }} + + {{- range after 1 .Site.Menus.main.ByWeight -}} + {{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}} + {{- with .Page -}} + {{- $active = or $active ( $.IsDescendant .) -}} + {{- end -}} + {{- $url := urls.Parse .URL -}} + {{- $baseurl := urls.Parse $.Site.Params.Baseurl -}} + <li class="nav-menu-margins-left-and-right{{if $active }} nav-menu-active{{end}}"> <a href="{{ with .Page }}{{ .RelPermalink }}{{ else }}{{ .URL | relLangURL }}{{ end }}"{{ if ne $url.Host $baseurl.Host }}target="_blank" {{ end }}>{{ .Name }}</a> </li> {{ end }} |