mirror of
https://github.com/imfing/hextra.git
synced 2025-06-20 15:31:18 -04:00
feat: add multi-language select and fix minor issues
fix: navbar icon should use home relative link fix: copy code for raw <code> element fix: missing breadcrumb hover style fix: tabs typo preventing loading the script
This commit is contained in:
25
layouts/partials/utils/lang-link.html
Normal file
25
layouts/partials/utils/lang-link.html
Normal file
@ -0,0 +1,25 @@
|
||||
{{/* Get relative link of a page for given language */}}
|
||||
{{/* If not found, return the homepage of the language page */}}
|
||||
|
||||
{{ $page := .context }}
|
||||
{{ $lang := .lang }}
|
||||
|
||||
{{ $link := false }}
|
||||
|
||||
{{ range $page.AllTranslations }}
|
||||
{{ if eq .Language.Lang $lang }}
|
||||
{{ $link = .RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $link }}
|
||||
{{ range where $page.Sites ".Language.Lang" $lang }}
|
||||
{{ $link = .Home.RelPermalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if not $link }}
|
||||
{{ $link = site.Home.RelPermalink }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $link }}
|
Reference in New Issue
Block a user