Skip to content

Commit

Permalink
Add absURL to menus (#343)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Stratton <[email protected]>
  • Loading branch information
mattstratton authored Mar 1, 2021
1 parent 40522d6 commit 7dcdcce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ buildFuture = true
identifier = "podcasts"
url = "/books"
parent = "resources"
[[Menu.Main]]
name = "Internet"
identifier = "internet"
url = "https://www.google.com"

[params]
mainSections = ["episode"]
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{ .Name }}</a>
<div class="dropdown-menu">
{{ range sort .Children "Identifier"}}
<a class="dropdown-item{{ if $currentPage.IsMenuCurrent "Main" . }} active {{ end }}" href="{{ .URL }}">{{ .Name }}</a>
<a class="dropdown-item{{ if $currentPage.IsMenuCurrent "Main" . }} active {{ end }}" href="{{ .URL | absURL}}">{{ .Name }}</a>
{{ end }}
</div>
</li>
{{ else }}
<li class= "nav-item {{ if or ($currentPage.IsMenuCurrent "Main" .) ($currentPage.HasMenuCurrent "Main" .) }} active {{ end }}">
<a href="{{ .URL }}" class="nav-link">
<a href="{{ .URL | absURL }}" class="nav-link">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
Expand Down

0 comments on commit 7dcdcce

Please sign in to comment.