trwnh.com/unified.test.hugo/layouts/_default/single.as2

46 lines
981 B
Text
Raw Normal View History

{{- with .OutputFormats.Get "as2" }}
{{- $type := slice }}
{
"@context": "https://www.w3.org/ns/activitystreams"
{{- with .Permalink }},
"id": "{{ . }}"
{{- end }}
{{- if and $.Date $.Title }}
{{- $type = $type | append "Article" }}
{{- else }}
{{- $type = $type | append "Page" }}
{{- end }}
{{- with $type }}
{{- if eq (. | len) 1 }},
"type": "{{index . 0}}"
{{- else }},
"type": {{ . | jsonify }}
{{- end }}
{{- end }}
{{- if $.Params.title }}
{{- with $.Title | jsonify }},
"name": {{.}}
{{- end }}
{{- end }}
{{- if $.Params.summary }}
{{- with $.Summary | jsonify }},
"summary": {{.}}
{{- end }}
{{- end }}
{{- if $.Params.date }}
{{- with $.Date.Format "2006-01-02T15:04:05-07:00" | jsonify }},
"published": {{.}}
{{- end }}
{{- end }}
{{- with $.Permalink }},
"url": {
"href": "{{.}}"
{{- with $.Language }},
"hreflang": "{{.}}"
{{- end }},
"rel": ["canonical", "alternate"],
"mediaType": "text/html"
}
{{- end }}
}
{{- end }}