Include image attachments
This commit is contained in:
parent
ea9fab103d
commit
d18e85c12c
|
@ -4,8 +4,26 @@
|
||||||
],
|
],
|
||||||
"title": {{ (htmlUnescape .Title | safeHTML) | jsonify }},
|
"title": {{ (htmlUnescape .Title | safeHTML) | jsonify }},
|
||||||
"content": {{ (htmlUnescape .Content | safeHTML) | jsonify }},
|
"content": {{ (htmlUnescape .Content | safeHTML) | jsonify }},
|
||||||
"mediaType": "text/html",
|
|
||||||
"summary": {{ (htmlUnescape .Summary | safeHTML) | jsonify }},
|
"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 }},
|
"published": {{ dateFormat "2006-01-02T15:04:05-07:00" .Lastmod | jsonify }},
|
||||||
"updated": {{ dateFormat "2006-01-02T15:04:05-07:00" .Date | jsonify }},
|
"updated": {{ dateFormat "2006-01-02T15:04:05-07:00" .Date | jsonify }},
|
||||||
"id": "{{ .Permalink }}",
|
"id": "{{ .Permalink }}",
|
||||||
|
|
Reference in New Issue