mirror of
https://github.com/alanorth/hugo-theme-bootstrap4-blog.git
synced 2024-11-17 09:47:05 +01: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:
parent
3b3598960c
commit
d554b6bead
@ -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 }}",
|
||||
|
Loading…
Reference in New Issue
Block a user