mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
feat(i18n): Allow localizing menus with i18n dynamically
This commit is contained in:
parent
4272da7ee4
commit
2bc605480e
@ -62,7 +62,7 @@
|
|||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
|
{{ $active := or (eq $currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .)) }}
|
||||||
<li {{ if $active }} class='current' {{ end }}>
|
<li {{ if $active }} class='current' {{ end }}>
|
||||||
<a href='{{ .URL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
|
<a href='{{ .URL | absLangURL }}' {{ if eq .Params.newTab true }}target="_blank"{{ end }}>
|
||||||
{{ $icon := default .Pre .Params.Icon }}
|
{{ $icon := default .Pre .Params.Icon }}
|
||||||
{{ if .Pre }}
|
{{ if .Pre }}
|
||||||
{{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }}
|
{{ warnf "Menu item [%s] is using [pre] field to set icon, please use [params.icon] instead.\nMore information: https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }}
|
||||||
@ -70,7 +70,7 @@
|
|||||||
{{ with $icon }}
|
{{ with $icon }}
|
||||||
{{ partial "helper/icon" . }}
|
{{ partial "helper/icon" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<span>{{- .Name -}}</span>
|
<span>{{ i18n .Identifier | default .Name}}</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user