mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +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-label">{{ if $icon }}<i class="{{ $icon }}"></i>{{ end }}{{ if and $icon $title }} {{ end }}{{ $title | markdownify }}</div>
|
||||
<ul class="box-content attachments-files">
|
||||
{{- $fileLink := printf "%s/%s" (.Language.ContentDir | default "content") .File.Dir }}
|
||||
{{- $fileLink = replace (replace $fileLink "\\" "/") "content/" "" }}
|
||||
{{- $fileDir := printf "%s/%s" (.Language.ContentDir | default "content") .File.Dir }}
|
||||
{{- $fileDir = replace $fileDir "\\" "/" }}
|
||||
{{- $version := split hugo.Version "." }}
|
||||
{{- $major := int (index $version 0) }}
|
||||
{{- $minor := int (index $version 1) }}
|
||||
{{- $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 }}
|
||||
{{- if and (eq .File.BaseFileName "index") (fileExists (printf "%sfiles" $fileDir)) }}
|
||||
{{- $c := "" }}{{/* backward compat to < 5.9.0 behavior */}}
|
||||
|
|
Loading…
Reference in a new issue