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.

40 lines
1.3KB

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