mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-12-22 22:52:54 +00:00
Allow custom menus
This commit is contained in:
parent
c99e22b05a
commit
d582fa6592
2 changed files with 38 additions and 0 deletions
|
@ -42,6 +42,16 @@ theme = "introduction"
|
|||
url = "https://linkedin.com/"
|
||||
icon = "linkedin"
|
||||
|
||||
# If you don`t want to use the default menu, you can define one by yoursel
|
||||
# [[menu.main]]
|
||||
# name = "Home"
|
||||
# url = "/"
|
||||
# weight = 0
|
||||
# [[menu.main]]
|
||||
# name = "Blog"
|
||||
# url = "/blog"
|
||||
# weight = 1
|
||||
|
||||
[languages]
|
||||
[languages.en]
|
||||
languageName = "English"
|
||||
|
|
|
@ -9,6 +9,33 @@
|
|||
<span></span>
|
||||
</span>
|
||||
<div id="nav-menu" class="nav-left nav-menu">
|
||||
<!-- look for custom menu and include it -->
|
||||
{{ if .Site.Menus.main }}
|
||||
{{ range .Site.Menus.main }}
|
||||
{{ if .HasChildren }}
|
||||
<a class="nav-item" href="{{ .URL }}">
|
||||
{{ .Pre }}
|
||||
{{ .Name }}
|
||||
{{ .Post }}
|
||||
</a>
|
||||
{{ range .Children }}
|
||||
<!-- TODO: style children diffrent then parents-->
|
||||
<a class="nav-item" href="{{ .URL }}">
|
||||
{{ .Pre }}
|
||||
{{ .Name }}
|
||||
{{ .Post }}
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<a class="nav-item" href="{{ .URL }}">
|
||||
{{ .Pre }}
|
||||
{{ .Name }}
|
||||
{{ .Post }}
|
||||
</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
<!-- use default menu -->
|
||||
{{ if not $isHome }}
|
||||
<a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a>
|
||||
{{ end }}
|
||||
|
@ -61,6 +88,7 @@
|
|||
{{ if and .Site.Params.showRSSButton .Site.RSSLink }}
|
||||
<a class="nav-item" href="{{ .Site.RSSLink }}"><i class="fa fa-rss"></i></a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</nav>
|
||||
<hr>
|
||||
|
|
Loading…
Reference in a new issue