Skip to content

Commit

Permalink
attachments: fix links if only one language is present matcornic#503 m…
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Mar 14, 2023
1 parent e619dab commit f4d9ce0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions layouts/partials/shortcodes/attachments.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}>
Expand Down

0 comments on commit f4d9ce0

Please sign in to comment.