attachments: fix links if only one language is present #503 #501

This commit is contained in:
Sören Weber 2023-03-14 21:16:42 +01:00
parent e619dabc51
commit f4d9ce016b
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -21,9 +21,12 @@
{{- end }}
{{- $sort := .sort | default "asc" }}
{{- $pattern := .pattern | default "" }}
{{- $defaultLanguage := (index $context.Site.Home.AllTranslations 0).Lang }}
{{- $defaultLanguagePage := index (where $context.Page.AllTranslations "Language.Lang" $defaultLanguage) 0 }}
{{- $defaultUrlPrefix := strings.TrimRight "/" $defaultLanguagePage.RelPermalink }}
{{- $defaultUrlPrefix := strings.TrimRight "/" $context.Page.RelPermalink }}
{{- if .IsTranslated -}}
{{- $defaultLanguage := (index $context.Site.Home.AllTranslations 0).Lang }}
{{- $defaultLanguagePage := index (where $context.Page.AllTranslations "Language.Lang" $defaultLanguage) 0 }}
{{- $defaultUrlPrefix = strings.TrimRight "/" $defaultLanguagePage.RelPermalink }}
{{- end }}
{{- $urlPrefix := strings.TrimRight "/" $context.Page.RelPermalink }}
{{- with $context }}
<div class="box attachments cstyle {{ $style }}"{{ if $color }} style="--VARIABLE-BOX-color: {{ $color }};"{{ end }}>