mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2025-05-07 21:16:00 +02:00
layouts/_default/single.html: Only get imageConfig on local images
Don't try to get image information when the image isn't local. We generally expect that images are in the local filesystem's static directory, but if the user has specified a remote image—ie, with an http:// or https:// prefix—then we shouldn't try imageConfig.
This commit is contained in:
@ -10,11 +10,15 @@
|
||||
{{- with .Params.images -}}{{ range first 1 . }}
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": "{{ . | absURL }}",
|
||||
{{ with (imageConfig (printf "/static/%s" .)) }}
|
||||
"url": "{{ . | absURL }}"
|
||||
{{- /* Don't try to get imageConfig if image param is not local */ -}}
|
||||
{{- if not (or (hasPrefix . "http://") (hasPrefix . "https://")) -}}
|
||||
{{- with (imageConfig (printf "/static/%s" .)) -}}
|
||||
,
|
||||
"height": "{{ .Height }}",
|
||||
"width": "{{ .Width }}"
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
},
|
||||
{{- end -}}{{ end }}
|
||||
"url": "{{ printf "%s" .Permalink }}",
|
||||
|
Reference in New Issue
Block a user