79 lines
2 KiB
Text
79 lines
2 KiB
Text
|
{{ $id := "" }}
|
||
|
{{- with .OutputFormats.Get "as2" -}}
|
||
|
{{- $id = .Permalink }}
|
||
|
{{- end }}
|
||
|
{{- $type := slice "OrderedCollection" -}}
|
||
|
{
|
||
|
"@context": "https://www.w3.org/ns/activitystreams"
|
||
|
{{- with $id }},
|
||
|
"id": "{{ . }}"
|
||
|
{{- end }}{{/* with id */}}
|
||
|
{{- with $type }}
|
||
|
{{- if eq (. | len) 1 }},{{/* single type */}}
|
||
|
"type": "{{index . 0}}"
|
||
|
{{- else }},{{/* multiple types */}}
|
||
|
"type": {{ . | jsonify }}
|
||
|
{{- end }}{{/* end if single type */}}
|
||
|
{{- end }}{{/* end with $type */}}
|
||
|
{{- with .Title | jsonify }},
|
||
|
"name": {{.}}
|
||
|
{{- end }}{{/* end with Title */}}
|
||
|
{{- if .Params.summary }}{{/* only consider explicitly-set summaries */}}
|
||
|
{{- with .Summary | jsonify }},
|
||
|
"summary": {{.}}
|
||
|
{{- end }}{{/* end with Summary */}}
|
||
|
{{- end }}{{/* end if Params.summary */}},
|
||
|
"attributedTo": { {{/* TODO: make this variable instead of hardcoded */}}
|
||
|
{{- $ownerId := "" }}
|
||
|
{{- with .Site.Home.OutputFormats.Get "as" }}
|
||
|
{{- $ownerId = .Permalink }}
|
||
|
{{- end }}
|
||
|
{{- with $ownerId }}
|
||
|
"id": "{{ $ownerId }}",
|
||
|
{{ end }}
|
||
|
"type": "Person",
|
||
|
"url": {
|
||
|
"href": "{{.Site.Home.Permalink}}"
|
||
|
{{- with .Language }},
|
||
|
"hreflang": "{{.}}"
|
||
|
{{- end }},
|
||
|
"rel": "canonical",
|
||
|
"mediaType": "text/html"
|
||
|
}
|
||
|
}
|
||
|
{{- if .Permalink }},
|
||
|
"url": {
|
||
|
"href": "{{.Permalink}}"
|
||
|
{{- with .Language }},
|
||
|
"hreflang": "{{.}}"
|
||
|
{{- end }},
|
||
|
"rel": "canonical",
|
||
|
"mediaType": "text/html"
|
||
|
}
|
||
|
{{- end }}{{/* end if Permalink */}}
|
||
|
{{- with .Pages }},
|
||
|
"orderedItems": [
|
||
|
{{- range $index, $item := . }}
|
||
|
{{- $itemId := "" }}
|
||
|
{{- with .OutputFormats.Get "as2" }}
|
||
|
{{- $itemId = .Permalink }}
|
||
|
{{- end }}
|
||
|
{
|
||
|
{{- with $itemId }}
|
||
|
"id": "{{ . }}"
|
||
|
{{- end }}
|
||
|
{{- if .Permalink }},
|
||
|
"url": {
|
||
|
"href": "{{.Permalink}}"
|
||
|
{{- with .Language }},
|
||
|
"hreflang": "{{.}}"
|
||
|
{{- end }},
|
||
|
"rel": "canonical",
|
||
|
"mediaType": "text/html"
|
||
|
}
|
||
|
{{- end }}{{/* end if Permalink */}}
|
||
|
}{{ if ne $index (sub (len $.Pages) 1)}},{{end}}
|
||
|
{{- end }}{{/* end range Pages */}}
|
||
|
]
|
||
|
{{- end }}{{/* end with Pages */}}
|
||
|
}
|