1
Fork 0

Include image attachments

This commit is contained in:
Jan-Lukas Else 2020-02-19 12:32:05 +01:00
parent ea9fab103d
commit d18e85c12c
1 changed files with 19 additions and 1 deletions

View File

@ -4,8 +4,26 @@
],
"title": {{ (htmlUnescape .Title | safeHTML) | jsonify }},
"content": {{ (htmlUnescape .Content | safeHTML) | jsonify }},
"mediaType": "text/html",
"summary": {{ (htmlUnescape .Summary | safeHTML) | jsonify }},
{{- if .Params.images }}
"attachment": [
{{ $delimiter := "" -}}
{{ range .Params.images }}
{{- $delimiter -}}{
"type": "Image",
"url": "{{ . }}",
{{ $lowerUrl := lower . -}}
{{- if or ( strings.HasSuffix $lowerUrl "jpg" ) ( strings.HasSuffix $lowerUrl "jpeg" ) -}}
"mediaType": "image/jpeg"
{{- else -}}
"mediaType": "image/png"
{{- end }}
}
{{- $delimiter = "," -}}
{{ end }}
],
{{ end -}}
"mediaType": "text/html",
"published": {{ dateFormat "2006-01-02T15:04:05-07:00" .Lastmod | jsonify }},
"updated": {{ dateFormat "2006-01-02T15:04:05-07:00" .Date | jsonify }},
"id": "{{ .Permalink }}",