{{ define "main" }}
{{ partial "pagination.html" . }} {{ range .Paginator.Pages}} {{ if not (eq .Type "response")}}
{{if eq .Type "article" }}
{{ with .Page.Params.Image }}{{ partial "taxonomy/image.html" . }}{{ end }}

{{ .Title }}

{{ .Description }}{{ end }} {{ if eq .Type "article" }}
{{ .ReadingTime }}-minute read

{{ with .Page.Params.Blog }} {{ partial "taxonomy/blog.html" . }}{{ end }}
{{ with .Page.Params.category }}{{ partial "taxonomy/categories.html" . }}{{ end }}{{ with .Page.Params.tag }}, {{ partial "taxonomy/tags.html" . }}{{ end }}
{{ end }}
{{ if eq .Type "article"}}{{ .Summary }}{{else}}{{ .Content }}{{end}} {{ if eq .Type "photo"}}
{{$link := .Permalink}} {{$summary := .Content}} {{ range .Page.Params.Photo }} {{ if isset . "value" }} {{ .alt }} {{ else }} Alt not yet added, will fix! {{end}}{{end}}
{{end}}

{{ if not (eq .Type "article") }}
{{ $mention_ids := index $.Site.Data.index .RelPermalink }} {{ $mentions := apply $mention_ids "index" $.Site.Data.mentions "." }} {{ $.Scratch.Set "likecount" 0 }} {{ $.Scratch.Set "sharecount" 0 }} {{ $.Scratch.Set "commentcount" 0 }} {{ $.Scratch.Set "mentioncount" 0 }} {{ range $mentions }} {{ if eq (index . "wm-property") "like-of" }}{{ $.Scratch.Add "likecount" 1 }}{{ end }} {{ if eq (index . "wm-property") "repost-of" }}{{ $.Scratch.Add "sharecount" 1 }}{{ end }} {{ if eq (index . "wm-property") "in-reply-to" }}{{ $.Scratch.Add "commentcount" 1 }}{{ end }} {{ if eq (index . "wm-property") "mention" }}{{ $.Scratch.Add "mentioncount" 1 }}{{ end }} {{ end }} {{ $likecount := $.Scratch.Get "likecount" }}{{ if ne $likecount 0 }} {{$likecount}} like{{if gt $likecount 1}}s{{end}}{{end}} {{ $sharecount := $.Scratch.Get "sharecount" }}{{ if ne $sharecount 0 }} {{$sharecount}} share{{if gt $sharecount 1}}s{{end}}{{end}} {{ $commentcount := $.Scratch.Get "commentcount" }}{{ if ne $commentcount 0 }} {{$commentcount}} repl{{if gt $commentcount 1}}ies{{else}}y{{end}}{{end}} {{ $mentioncount := $.Scratch.Get "mentioncount" }}{{ if ne $mentioncount 0 }} {{$mentioncount}} mention{{if gt $mentioncount 1}}s{{end}}{{end}} {{ with .Page.Params.category }}{{ partial "taxonomy/categories.html" . }}{{ end }}{{ with .Page.Params.tag }}, {{ partial "taxonomy/tags.html" . }}{{ end }}
{{ end }}
{{ else }}

{{ .Site.Params.Title }} {{ if eq .Params.posttype "like-of" }} liked {{ .Params.xAuthor }}'s {{ .Params.xPostType }}{{ end }} {{ if eq .Params.posttype "in-reply-to" }} replied to {{ .Params.xAuthor }}'s {{ .Params.xPostType }}{{ end }} {{ if eq .Params.posttype "repost-of" }} shared {{ .Params.xAuthor }}'s {{ .Params.xPostType }}{{ end }}

{{ if .Params.xContent }}
{{ .Params.xAuthor }}'s avatar{{ dateFormat "Mon, 02 Jan 2006 15:04:05 GMT" .Params.xPublished }}
{{ .Params.xContent }}
{{end}} {{ if not (eq .Type "article") }}
{{ with .Page.Params.category }}Categories: {{ partial "taxonomy/categories.html" . }}{{ end }}
{{ end }}
{{end}} {{ end }} {{ partial "pagination.html" . }}
{{ end }}