1
0
Fork 0

implement multilang

This commit is contained in:
dark_hash 2025-01-21 18:00:16 +01:00
parent 089bf1ffbb
commit 563b95aab1
4 changed files with 9 additions and 6 deletions

View file

@ -5,7 +5,11 @@
{{ . }}
</div>
{{- end }}
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
{{ $pages := .Site.RegularPages }}
{{ range .Site.Home.Translations }}
{{ $pages = $pages | lang.Merge .Site.RegularPages }}
{{ end }}
{{ $paginator := .Paginate (where $pages "Type" "in" .Site.Params.mainSections) }}
{{- range $paginator.Pages }}
{{- .Render "summary" }}
{{- end }}

View file

@ -2,7 +2,7 @@
<div class="footer__links">
{{ range $key, $value := . }}
{{- if ne $key 0 }} | {{ end -}}
<a class="footer__link" href="{{ $value.URL }}" {{- if not .Page }} target="_blank"{{ end }}>{{ $value.Name }}</a>
<a class="footer__link" href="{{ $value.URL }}" {{- if not .Page }} target="_blank"{{ end }}>{{ i18n $value.Identifier | default $value.Name}}</a>
{{- end }}
</div>
{{- end }}

View file

@ -8,9 +8,9 @@
{{- range .Site.Menus.main }}
{{- if .Name }}
<li class="menu__item{{ if or ($currentNode.IsMenuCurrent "main" .) ($currentNode.HasMenuCurrent "main" .) }} menu__item--active{{ end }}">
<a class="menu__link" href="{{ .URL }}" {{- if not .Page }} target="_blank"{{ end }}>
<a class="menu__link" href="{{ .URL }}" {{- if not .Page }} target="_blank"{{ end }}>
{{ .Pre }}
<span class="menu__text">{{ .Name }}</span>
<span class="menu__text">{{ i18n .Identifier | default .Name}}</span>
{{ .Post }}
</a>
</li>

View file

@ -1,7 +1,6 @@
{{- $translations := .Site.Home.AllTranslations }}
{{- if and .Site.IsMultiLingual (gt (len $translations) 0) }}
{{- if and hugo.IsMultilingual (gt (len $translations) 0) }}
<div class="widget-languages widget">
<h4 class="widget__title">{{ T "languages_title" }}</h4>
<div class="widget__content">
<ul class="widget__list">
{{- range $translations }}