ActivityStreams for Hugo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.2KB

  1. {
  2. "@context": [
  3. "https://www.w3.org/ns/activitystreams"
  4. ],
  5. "title": {{ (htmlUnescape .Title | safeHTML) | jsonify }},
  6. "content": {{ (htmlUnescape .Content | safeHTML) | jsonify }},
  7. "summary": {{ (htmlUnescape .Summary | safeHTML) | jsonify }},
  8. {{- if .Params.images }}
  9. "attachment": [
  10. {{ $delimiter := "" -}}
  11. {{ range .Params.images }}
  12. {{- $delimiter -}}{
  13. "type": "Image",
  14. "url": "{{ . }}",
  15. {{ $lowerUrl := lower . -}}
  16. {{- if or ( strings.HasSuffix $lowerUrl "jpg" ) ( strings.HasSuffix $lowerUrl "jpeg" ) -}}
  17. "mediaType": "image/jpeg"
  18. {{- else -}}
  19. "mediaType": "image/png"
  20. {{- end }}
  21. }
  22. {{- $delimiter = "," -}}
  23. {{ end }}
  24. ],
  25. {{ end -}}
  26. "mediaType": "text/html",
  27. "published": {{ dateFormat "2006-01-02T15:04:05-07:00" .Lastmod | jsonify }},
  28. "updated": {{ dateFormat "2006-01-02T15:04:05-07:00" .Date | jsonify }},
  29. "id": "{{ .Permalink }}",
  30. "url": "{{ .Permalink }}",
  31. "type": "Article",
  32. "attributedTo": "{{ "" | absLangURL }}",
  33. "to": ["https://www.w3.org/ns/activitystreams#Public"]
  34. }