mirror of
https://github.com/theNewDynamic/gohugo-theme-ananke.git
synced 2025-06-08 17:22:46 +00:00
Support absolute paths for image resources (#362)
This commit is contained in:
parent
90d52ed82e
commit
3e01b66d29
@ -27,12 +27,14 @@
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{/* If we find a local global Resource matching the exact value, we use it. */}}
|
||||
{{ with resources.GetMatch . }}
|
||||
{{/* Matching uses relative paths so strip a leading / character if present. */}}
|
||||
{{ with resources.GetMatch (trim . "/") }}
|
||||
{{ $coverImage = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{/* If we find a Page Resource matching the exact value, we use it instead. */}}
|
||||
{{ with $.Resources.GetMatch . }}
|
||||
{{/* Matching uses relative paths so strip a leading / character if present. */}}
|
||||
{{ with $.Resources.GetMatch (trim . "/") }}
|
||||
{{ $coverImage = . }}
|
||||
{{ end }}
|
||||
{{/* Find the first image with 'cover' in the name in this page bundle. */}}
|
||||
|
@ -1,5 +1,6 @@
|
||||
{{ $srcset := slice }}
|
||||
{{- with .Page.Resources.GetMatch (.Get "src") -}}
|
||||
{{/* Matching uses relative paths so strip a leading / character if present. */}}
|
||||
{{- with .Page.Resources.GetMatch (trim (.Get "src") "/") -}}
|
||||
{{- /* Standard width of main is 70% (w-70-ns) */ -}}
|
||||
{{- $target_width := 0.70 -}}
|
||||
{{ $srcset = partial "func/GetImageSrcset" (dict "original" . "target_width" $target_width) }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user