Merge pull request #25 from bedefaced/main
Current page detection & links of translations for multilingual mode
This commit is contained in:
commit
2852ac6867
3 changed files with 29 additions and 2 deletions
|
|
@ -1,2 +1,29 @@
|
||||||
|
<p>
|
||||||
|
{{ $siteLanguages := .Site.Languages }}
|
||||||
|
{{ $pageLang := .Page.Lang }}
|
||||||
|
|
||||||
|
{{ $currentPage := . }}
|
||||||
|
{{ $pageName := "" }}
|
||||||
|
{{ range .Site.Menus.main }}
|
||||||
|
{{ if eq ($currentPage.Permalink) (.URL | absLangURL) }}
|
||||||
|
{{ $pageName = .Name }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ range .Page.AllTranslations }}
|
||||||
|
{{ $translation := .}}
|
||||||
|
{{ range $siteLanguages }}
|
||||||
|
{{ if eq $translation.Lang .Lang }}
|
||||||
|
{{ $selected := false }}
|
||||||
|
{{ if eq $pageLang .Lang }}
|
||||||
|
<br/><span class="active">$ echo $LANG<br/><b>{{ .LanguageName }}</b></span><br/>
|
||||||
|
{{ else }}
|
||||||
|
<br/><a href="{{ $translation.Permalink }}">export LANG={{ .LanguageName }}; ./{{ $pageName }}</a><br/>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</p>
|
||||||
|
<br/><br/>
|
||||||
<p class="copyright">{{ .Site.Copyright }}</p>
|
<p class="copyright">{{ .Site.Copyright }}</p>
|
||||||
<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p>
|
<p class="advertisement">Powered by <a href="https://gohugo.io/">hugo</a> and <a href="https://github.com/joeroe/risotto">risotto</a>.</p>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
{{ with .Site.Params.about }}<meta name="description" content="{{ .description }}">{{ end }}
|
{{ with .Site.Params.about }}<meta name="description" content="{{ .description }}">{{ end }}
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="utf-8"/>
|
<meta charset="UTF-8"/>
|
||||||
{{ if .Site.Params.noindex }}<meta name="robots" content="noindex" /> {{ end }}
|
{{ if .Site.Params.noindex }}<meta name="robots" content="noindex" /> {{ end }}
|
||||||
|
|
||||||
<!-- FontAwesome <https://fontawesome.com/> -->
|
<!-- FontAwesome <https://fontawesome.com/> -->
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{{ $currentPage := . }}
|
{{ $currentPage := . }}
|
||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
<li class="main-nav__item"><a class="nav-main-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a></li>
|
<li class="main-nav__item"><a class="nav-main-item{{ if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) (eq ($currentPage.Permalink) (.URL | absLangURL)) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue