Résout les images référencées par des métadonnées YAML
This commit is contained in:
@@ -61,14 +61,34 @@
|
||||
{{- $coverDataFile = $page.Resources.Get (printf "data/%s.yaml" $coverName) -}}
|
||||
{{- end -}}
|
||||
{{- if $coverDataFile -}}
|
||||
{{- $coverData = $coverDataFile.Content | transform.Unmarshal -}}
|
||||
{{- with $coverDataFile.Content | transform.Unmarshal -}}
|
||||
{{- $coverData = . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $coverImage := false -}}
|
||||
{{- $coverDisplay := false -}}
|
||||
{{- if $showCover -}}
|
||||
{{- $coverImage = $page.Resources.GetMatch $coverPath -}}
|
||||
{{- $coverResourcePath := (urls.Parse $coverPath).Path -}}
|
||||
{{- if ne $coverResourcePath "" -}}
|
||||
{{- $coverPathLower := lower $coverResourcePath -}}
|
||||
{{- if or (strings.HasSuffix $coverPathLower ".yaml") (strings.HasSuffix $coverPathLower ".yml") -}}
|
||||
{{- $coverMetaFile := $page.Resources.Get $coverResourcePath -}}
|
||||
{{- if $coverMetaFile -}}
|
||||
{{- with $coverMetaFile.Content | transform.Unmarshal -}}
|
||||
{{- with index . "file" -}}
|
||||
{{- $coverFilePath := strings.TrimSpace (printf "%v" .) -}}
|
||||
{{- if ne $coverFilePath "" -}}
|
||||
{{- $coverImage = $page.Resources.Get $coverFilePath -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- $coverImage = $page.Resources.Get $coverResourcePath -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $coverImage -}}
|
||||
{{- $coverDisplay = $coverImage -}}
|
||||
{{- if ne $coverDisplay.MediaType.SubType "svg" -}}
|
||||
|
||||
Reference in New Issue
Block a user