diff options
author | Andrew <anjanjanj@users.noreply.github.com> | 2020-06-27 19:33:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-27 19:33:38 +0300 |
commit | 0e080d23bf6e6ec65daaa234d845cca28839d7fe (patch) | |
tree | 624ea946ea2665f099a688efffd32c9f82ccaef6 | |
parent | 17af6e51ae880e58c87e4ccecd98040c5a7a7ae7 (diff) |
Add support for standard main menu (#6)
-rw-r--r-- | exampleSite/config.toml | 15 | ||||
-rw-r--r-- | layouts/partials/header.html | 5 |
2 files changed, 17 insertions, 3 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 72d9c45..d17f0f0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -12,6 +12,21 @@ pygmentsUseClasses = true dark = "auto" 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] posts = "/:title/" diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 68b251e..3df21cd 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -2,10 +2,9 @@ <h2><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h2> <nav> <ul> - <li><a href="{{ .Site.BaseURL }}">posts</a></li> - {{ range where .Site.Home.Pages "Title" "!=" "Posts" }} + {{ range .Site.Menus.main.ByWeight }} <li> - <a href="{{ .Permalink }}">{{ .Title }}</a> + {{ .Pre }}<a href="{{ .URL }}" title="{{ .Title }}">{{- .Name -}}</a>{{ .Post }} </li> {{ end }} </ul> |