Submenu URL localization
This commit is contained in:
parent
a1a92b0145
commit
7b0e81b43b
28
hugo.yaml
28
hugo.yaml
|
@ -138,33 +138,23 @@ menu:
|
|||
- identifier: foundation
|
||||
name: Foundation
|
||||
url: /about/foundation/
|
||||
params:
|
||||
url_en: /en/become-a-member/
|
||||
url_de: /de/mitglied-werden/
|
||||
weight: 10
|
||||
- identifier: board
|
||||
name: Board
|
||||
url: /about/board/
|
||||
params:
|
||||
url_en: /en/about/board/
|
||||
url_de: /de/ueber/vorstand/
|
||||
weight: 20
|
||||
- identifier: documents
|
||||
name: Dokuments
|
||||
url: /about/documents/
|
||||
weight: 30
|
||||
dropdown:
|
||||
- identifier: foundation
|
||||
pre: stars # can be stars, comments or piechart
|
||||
name: Appearance
|
||||
post: "Easy customization"
|
||||
url: "#"
|
||||
weight: 10
|
||||
- identifier: comments
|
||||
pre: comments # can be stars, comments or piechart
|
||||
name: Comments
|
||||
post: "Check your latest comments"
|
||||
url: "#"
|
||||
weight: 20
|
||||
- identifier: analytics
|
||||
pre: piechart # can be stars, comments or piechart
|
||||
name: Analytics
|
||||
post: "Take a look at your statistics"
|
||||
url: "#"
|
||||
params:
|
||||
url_en: /en/about/documents/
|
||||
url_de: /de/ueber/dokumente/
|
||||
weight: 30
|
||||
footer:
|
||||
- identifier: about
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{{- if eq .lang "en" -}}
|
||||
{{- with .menu.url_en -}}
|
||||
{{- with .menu.Params.url_en -}}
|
||||
{{- relURL . -}}
|
||||
{{- else -}}
|
||||
{{- .menu.URL | absLangURL -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- with .menu.url_de -}}
|
||||
{{- with .menu.Params.url_de -}}
|
||||
{{- relURL . -}}
|
||||
{{- else -}}
|
||||
{{- .menu.URL | absLangURL -}}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<nav :class="{'flex': open, 'hidden': !open}"
|
||||
class="flex-col flex-grow hidden pb-4 md:pb-0 md:flex md:justify-end md:flex-row">
|
||||
{{ range site.Menus.main }}
|
||||
{{ $menuCtx := (dict "lang" $.Site.Language.Lang "menu" .Params) }}
|
||||
{{ $menuCtx := (dict "lang" $.Site.Language.Lang "menu" .) }}
|
||||
{{ if (eq "complexdropdown" .Pre) }}
|
||||
<div @click.away="open = false" class="relative" x-data="{ open: false }">
|
||||
<button @click="open = !open"
|
||||
|
@ -47,6 +47,7 @@
|
|||
<div class="px-2 pt-2 pb-4 bg-white rounded-md shadow-lg text-zinc-900">
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
{{ range (index site.Menus .Identifier) }}
|
||||
{{ $menuCtx := (dict "lang" $.Site.Language.Lang "menu" .) }}
|
||||
<a class="flex items-start p-2 bg-transparent rounded-lg group row hover:text-white focus:text-white hover:bg-primary-600 focus:bg-primary-700 focus:outline-none focus:shadow-outline"
|
||||
href="{{ partial "menu-url.html" $menuCtx }}">
|
||||
<div class="p-3 text-white bg-primary-600 rounded-lg group-hover:bg-gray-900">
|
||||
|
@ -109,6 +110,7 @@
|
|||
class="absolute right-0 z-30 w-full mt-2 origin-top-right rounded-md shadow-lg md:w-48">
|
||||
<div class="px-2 py-2 text-primary-900 bg-white rounded-md shadow">
|
||||
{{ range (index site.Menus .Identifier) }}
|
||||
{{ $menuCtx := (dict "lang" $.Site.Language.Lang "menu" .) }}
|
||||
<a class="block px-4 py-2 mt-2 text-sm font-semibold bg-transparent rounded-lg md:mt-0 hover:text-white focus:text-white hover:bg-primary-600 focus:bg-primary-600 focus:outline-none focus:shadow-outline"
|
||||
href="{{ partial "menu-url.html" $menuCtx }}">{{- or (T .Identifier) .Name | safeHTML -}}
|
||||
</a>
|
||||
|
|
Loading…
Reference in New Issue