Add support for standard main menu (#6)

This commit is contained in:
Andrew 2020-06-27 17:33:38 +01:00 committed by GitHub
parent 17af6e51ae
commit 0e080d23bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View file

@ -12,6 +12,21 @@ pygmentsUseClasses = true
dark = "auto" dark = "auto"
highlight = true highlight = true
[menu]
[[menu.main]]
identifier = "posts"
name = "posts"
title = "posts"
url = "/"
weight = 10
[[menu.main]]
identifier = "about"
name = "about"
title = "about"
url = "/about/"
weight = 20
[permalinks] [permalinks]
posts = "/:title/" posts = "/:title/"

View file

@ -2,10 +2,9 @@
<h2><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h2> <h2><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h2>
<nav> <nav>
<ul> <ul>
<li><a href="{{ .Site.BaseURL }}">posts</a></li> {{ range .Site.Menus.main.ByWeight }}
{{ range where .Site.Home.Pages "Title" "!=" "Posts" }}
<li> <li>
<a href="{{ .Permalink }}">{{ .Title }}</a> {{ .Pre }}<a href="{{ .URL }}" title="{{ .Title }}">{{- .Name -}}</a>{{ .Post }}
</li> </li>
{{ end }} {{ end }}
</ul> </ul>