mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
attachments: fix build error since Hugo 0.112 #540
This commit is contained in:
parent
a135b2adb4
commit
7daec21538
1 changed files with 12 additions and 4 deletions
|
@ -32,10 +32,18 @@
|
||||||
<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 }}>
|
||||||
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div>
|
<div class="box-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div>
|
||||||
<ul class="box-content attachments-files">
|
<ul class="box-content attachments-files">
|
||||||
{{- $fileLink := printf "%s/%s" (.Language.ContentDir | default "content") .File.Dir }}
|
{{- $version := split hugo.Version "." }}
|
||||||
{{- $fileLink = replace (replace $fileLink "\\" "/") "content/" "" }}
|
{{- $major := int (index $version 0) }}
|
||||||
{{- $fileDir := printf "%s/%s" (.Language.ContentDir | default "content") .File.Dir }}
|
{{- $minor := int (index $version 1) }}
|
||||||
{{- $fileDir = replace $fileDir "\\" "/" }}
|
{{- $fileDir := "" }}
|
||||||
|
{{- if or (and (eq $major 0) (ge $minor 112)) (gt $major 0) }}
|
||||||
|
{{- $fileDir = path.Dir (strings.TrimPrefix (path.Clean hugo.WorkingDir) (path.Clean .File.Filename)) }}
|
||||||
|
{{- else }}
|
||||||
|
{{- $fileDir = printf "%s/%s" (path.Clean (.Language.ContentDir | default "content")) (path.Clean .File.Dir) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $fileDir = printf "%s/" (path.Clean (strings.TrimPrefix "/" $fileDir)) }}
|
||||||
|
{{- $fileLink := $fileDir }}
|
||||||
|
{{- $fileLink = replace $fileLink "/content/" "" }}
|
||||||
{{- $filesName := printf "%s.files" .File.BaseFileName }}
|
{{- $filesName := printf "%s.files" .File.BaseFileName }}
|
||||||
{{- if and (eq .File.BaseFileName "index") (fileExists (printf "%sfiles" $fileDir)) }}
|
{{- if and (eq .File.BaseFileName "index") (fileExists (printf "%sfiles" $fileDir)) }}
|
||||||
{{- $c := "" }}{{/* backward compat to < 5.9.0 behavior */}}
|
{{- $c := "" }}{{/* backward compat to < 5.9.0 behavior */}}
|
||||||
|
|
Loading…
Reference in a new issue