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