Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EmielH/tale-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Rehkemper <gavinr@users.noreply.github.com>2019-10-09 11:39:50 +0300
committerEmiel Hollander <EmielH@users.noreply.github.com>2019-10-09 11:39:50 +0300
commit7a84b69b223dd9f69c58b90164ff3b35a4af3161 (patch)
tree91fc049b775e6e04984ece660858b760d972bad2
parent636e30ecbb2b336712f054320eb0891513e9d9f3 (diff)
Add dynamic header menu using Hugo Menu's
Added dynamic header menu, Hugo-style Template from https://gohugo.io/templates/menu-templates Removed unused i18n See #29
-rw-r--r--README.md36
-rw-r--r--i18n/en.toml6
-rw-r--r--layouts/partials/header-menu.html12
3 files changed, 46 insertions, 8 deletions
diff --git a/README.md b/README.md
index 50b8129..b32550a 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,42 @@ Alternatively, you can tell Hugo to use the theme with the `server` command.
hugo server -t tale
```
+#### Menu
+
+The top menu uses [Hugo Menus](https://gohugo.io/content-management/menus/), with the name of the menu being `main`. To turn on the menu, follow the steps there - you can either add something like this to the front-matter of your pages:
+
+```
+---
+menu: "main"
+---
+```
+
+... or you can add a menu section to your `config` file:
+
+```
+sectionPagesMenu = "main"
+```
+
+Or if you want more control, add a specific entry for each item in your menu:
+
+```
+[menu]
+ [[menu.main]]
+ identifier = "about"
+ name = "About"
+ title = "About"
+ url = "/about/"
+ weight = 0
+ [[menu.main]]
+ identifier = "posts"
+ name = "Posts"
+ title = "Posts"
+ url = "/posts/"
+ weight = 0
+```
+
+For menu internationalization/translation, see [Multilingual Mode: Menus](https://gohugo.io/content-management/multilingual/#menus).
+
### Additional information
For more information, read the official [setup guide](https//gohugo.io/overview/installing/) of Hugo.
diff --git a/i18n/en.toml b/i18n/en.toml
index e7de9a3..fc9961f 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -1,9 +1,3 @@
-[posts]
-other = "Posts"
-
-[about]
-other = "About"
-
[writtenBy]
other = "Written by"
diff --git a/layouts/partials/header-menu.html b/layouts/partials/header-menu.html
index 8bcdea4..52e6992 100644
--- a/layouts/partials/header-menu.html
+++ b/layouts/partials/header-menu.html
@@ -1,4 +1,12 @@
<ul>
- <li><a href="{{ "about" | relURL }}">{{ i18n "about" }}</a></li>
- <li><a href="{{ "/" | relURL }}">{{ i18n "posts" }}</a></li>
+ {{ $currentPage := . }}
+ {{ range .Site.Menus.main }}
+ <li>
+ <a href="{{ .URL }}">
+ {{ .Pre }}
+ <span>{{ .Name }}</span>
+ {{ .Post }}
+ </a>
+ </li>
+ {{ end }}
</ul> \ No newline at end of file