diff options
author | Huy Van Nguyen <huy.nguyenvan@asnet.com.vn> | 2020-05-15 11:46:32 +0300 |
---|---|---|
committer | Huy Van Nguyen <huy.nguyenvan@asnet.com.vn> | 2020-05-15 11:46:32 +0300 |
commit | cc3e87d5af84c67a4100820d8c8cae4930b54fae (patch) | |
tree | 50a2b8abd2b0677408763bed0f2d6f297cee3b66 | |
parent | 9a1990bcb407e8af03e9d47d5236bab97340bb56 (diff) |
Split navigation
-rw-r--r-- | layouts/partials/header.html | 7 | ||||
-rw-r--r-- | layouts/partials/navigation.html | 6 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 7 |
3 files changed, 8 insertions, 12 deletions
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index d4eb4bf..ad2c832 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -19,12 +19,7 @@ <!-- Sidebar is header on desktop --> <nav class="menu"> <ul class="menu-list"> - {{ $type := .Type }} - {{ $kind := .Kind }} - {{ $currentPage := . }} - {{ range .Site.Menus.main }} - <li class="menu-item {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} is-active{{ end }}{{ if and (eq .Identifier "home") (eq $type "post") }} is-active{{ end }}{{ if and (eq .Identifier "home") (and (eq $type "page") (eq $kind "taxonomy"))}} is-active{{ end }}"><a href="{{ .URL }}">{{ .Name }}</a></li> - {{ end }} + {{ partial "navigation.html" . }} </ul> </nav> diff --git a/layouts/partials/navigation.html b/layouts/partials/navigation.html new file mode 100644 index 0000000..829893f --- /dev/null +++ b/layouts/partials/navigation.html @@ -0,0 +1,6 @@ +{{ $type := .Type }} +{{ $kind := .Kind }} +{{ $currentPage := . }} +{{ range .Site.Menus.main }} + <li class="sidebar-item {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} is-active{{ end }}{{ if and (eq .Identifier "home") (eq $type "post") }} is-active{{ end }}{{ if and (eq .Identifier "home") (and (eq $type "page") (eq $kind "taxonomy"))}} is-active{{ end }}"><a class="sidebar-link" href="{{ .URL }}">{{ .Name }}</a></li> +{{ end }} diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index d610ef7..9e17ca5 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,11 +1,6 @@ <amp-sidebar id="sidebar" class="sidebar" layout="nodisplay" side="right"> <ul class="sidebar-list"> <li class="sidebar-menu"><button class="sidebar-icon" on="tap:sidebar.close">X</button></li> - {{ $type := .Type }} - {{ $kind := .Kind }} - {{ $currentPage := . }} - {{ range .Site.Menus.main }} - <li class="sidebar-item {{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} is-active{{ end }}{{ if and (eq .Identifier "home") (eq $type "post") }} is-active{{ end }}{{ if and (eq .Identifier "home") (and (eq $type "page") (eq $kind "taxonomy"))}} is-active{{ end }}"><a class="sidebar-link" href="{{ .URL }}">{{ .Name }}</a></li> - {{ end }} + {{ partial "navigation.html" . }} </ul> </amp-sidebar> |