{{ define "main" }}
<section class="stream h-feed">
  <section class="author" style="display:none;">
    <a rel="author" class="p-author h-card" rel="me" href="https://jk.nipponalba.scot">{{ .Site.Params.Title }}<img src="/images/profile.jpg"/></a>
  </section>
<span id="pagination-top">{{ partial "pagination.html" . }}</span>
            {{ range .Paginator.Pages}}
              {{ if not (eq .Type "response")}}<section data-post-type="{{ .Type }}" class="feed h-entry {{.Type }}">
                <section class="author" style="display:none;">
                  <a rel="author" class="u-author h-card" rel="me" href="https://jk.nipponalba.scot">{{ .Site.Params.Title }}<img src="/images/profile.jpg"/></a>
                </section>
                <article class="index_content">
                  {{if eq .Type "article" }}<br/>{{ with .Page.Params.images }}{{ partial "taxonomy/image.html" . }}{{ end }}<a href="{{ .Permalink }}" class="u-url"><h3 class="p-name entry-title">{{ .Title }}</h3></a><b>{{ .Description }}</b>{{ end }}
                  {{ if eq .Type "article" }}<section class="info">
                  <span class="info-date"><time class="dt-published" datetime="{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}">{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}</time></span><span class="reading-time">{{ .ReadingTime }}-minute read</span><br/><br/>
                  <span class="blogs_span">{{ with .Page.Params.Blog }}<i class="fa fa-pencil-square-o fa-1.5x fa-fw" aria-hidden="true" title="Tags"></i><b> {{ partial "taxonomy/blog.html" . }}{{ end }}</b></span><br/>
                  <span class="categories_span">{{ with .Page.Params.category }}<i class="fa fa-tags fa-1.5x fa-fw" aria-hidden="true" title="Tags"></i>{{ partial "taxonomy/categories.html" . }}{{ end }}{{ with .Page.Params.tag }}, {{ partial "taxonomy/tags.html" . }}{{ end }}</span>
                  </section>{{ end }}
                  <section class="e-content">
                    {{ if eq .Type "article"}}{{ .Summary }}{{else}}{{ .Content }}{{end}}
                    {{ if eq .Type "photo"}}
                    <section class="photos">
                      {{$link := .Permalink}}
                      {{$summary := .Content}}
                      {{ range .Page.Params.Photo }}
                      {{ if isset . "value" }}
                        <a href="{{ $link }}" class="u-url"><img class="u-photo thumb" src="{{ .value}}" title="{{ .alt }}" alt="{{ .alt }}"/></a>
                        {{ else }}
                        <a href="{{ $link }}" class="u-url"><img class="u-photo thumb" src="{{ . }}" title="{{ $summary }}" alt="Alt not yet added, will fix!"/></a>
                      {{end}}{{end}}
                    </section>
                      {{end}}
                  </section><br/>
                  {{ if not (eq .Type "article") }}<section class="info">
                    {{ $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 }}
                    <a href="{{ .Permalink }}"><span class="mini_interactions">{{ $likecount := $.Scratch.Get "likecount" }}{{ if ne $likecount 0 }} <i class="fa fa-thumbs-up fa-1.5x fa-fw" aria-hidden="true" title="Likes"></i>{{$likecount}} like{{if gt $likecount 1}}s{{end}}{{end}}
                    {{ $sharecount := $.Scratch.Get "sharecount" }}{{ if ne $sharecount 0 }} <i class="fa fa-share fa-1.5x fa-fw" aria-hidden="true" title="Shares"></i>{{$sharecount}} share{{if gt $sharecount 1}}s{{end}}{{end}}
                    {{ $commentcount := $.Scratch.Get "commentcount" }}{{ if ne $commentcount 0 }} <i class="fa fa-comment fa-1.5x fa-fw" aria-hidden="true" title="Replies"></i>{{$commentcount}} repl{{if gt $commentcount 1}}ies{{else}}y{{end}}{{end}}
                    {{ $mentioncount := $.Scratch.Get "mentioncount" }}{{ if ne $mentioncount 0 }} <i class="fa fa-sticky-note fa-1.5x fa-fw" aria-hidden="true" title="Mentions"></i>{{$mentioncount}} mention{{if gt $mentioncount 1}}s{{end}}{{end}}</span></a>
                    <span class="info-date-other"><a href="{{ .Permalink }}" class="u-url"><time class="dt-published" datetime="{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}">{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 GMT" }}</time></a>
                    <span class="syndication">
                      {{ if or (isset .Page.Params "pleromaurl") (isset .Page.Params "pixelfedurl")}}
                      - Syndication:
                      {{ with .Page.Params.pleromaurl  }}<a rel="syndication" class="u-syndication" href="{{ . }}"><i class="fa fa-pleroma fa-1.5x fa-fw" aria-hidden="true" title="Pleroma"></i></a>{{ end }}
                      {{ with .Page.Params.pixelfedurl  }}<a rel="syndication" class="u-syndication" href="{{ . }}"><i class="fa fa-pixelfed fa-1.5x fa-fw" aria-hidden="true" title="Pixelfed"></i></a>{{ end }}</span><span class="categories_span_other">{{ with .Page.Params.category }}{{ partial "taxonomy/categories.html" . }}{{ end }}{{ with .Page.Params.tag }}, {{ partial "taxonomy/tags.html" . }}{{ end }}
                      {{ end }}</span></span>
                      </section>{{ end }}
                </article>
                </section>
                {{ else }}
                <article class="{{ .Params.posttype }} h-entry entry" id="response">
                      <section class="author" style="display:none;">
                        <a rel="author" class="p-author  h-card" rel="me" href="https://jk.nipponalba.scot"><img src="/images/profile.jpg"/><div class="title">{{ .Site.Params.Title }}</div></a>
                      </section>
                      <section class="xrayReply"><p>{{ .Site.Params.Title }}
                          {{ if eq .Params.posttype "like-of" }} liked  <i class="fa fa-thumbs-up fa-1.5x fa-fw" aria-hidden="true" title="Likes"></i> <a href="{{ .Params.xAuthorUrl }}" target="_blank">{{ .Params.xAuthor }}</a>'s <a href="{{ index .Params "like-of" }}" class="u-like-of">{{ .Params.xPostType }}</a>{{ end }}
                          {{ if eq .Params.posttype "in-reply-to" }} replied to  <i class="fa fa-comment fa-1.5x fa-fw" aria-hidden="true" title="Likes"></i> <a href="{{ .Params.xAuthorUrl }}" target="_blank">{{ .Params.xAuthor }}</a>'s <a href="{{ index .Params "in-reply-to" }}" class="u-in-reply-to">{{ .Params.xPostType }}</a>{{ end }}
                          {{ if eq .Params.posttype "repost-of"  }}  shared  <i class="fa fa-share fa-1.5x fa-fw" aria-hidden="true" title="Likes"></i> <a href="{{ .Params.xAuthorUrl }}" target="_blank">{{ .Params.xAuthor }}</a>'s <a href="{{ index .Params "repost-of" }}" class="u-repost-of">{{ .Params.xPostType }}</a>{{ end }}</p>
                          {{ if .Params.xContent }}<section class="replyContext"><span class="remotePhoto"><a href="{{ .Params.xAuthorUrl }}" target="_blank"><img src="{{ .Params.xPhoto }}" title="{{ .Params.xAuthor }}" alt="{{ .Params.xAuthor }}'s avatar"/></a></span><span class="response-date">{{ .Params.xPublished }}</span><span class="response-text">{{ plainify .Params.xContent }}
                          {{ if .Params.xContentPhoto }}<br/><br/>{{ range .Params.xContentPhoto }}<img class="u-photo xContentPhoto" src="{{ . }}"/>{{ end }}{{ end }}</span></section><br/>{{end}}{{end}}
                          {{ if .Content }}<section class="e-content p-name"><br/>{{ .Content }}</section>{{ end }}
                          {{ if not (eq .Type "article") }}<section class="info">
                              <span class="categories_span">{{ with .Page.Params.category }}Categories: {{ partial "taxonomy/categories.html" . }}{{ end }}</span><span class="info-date"><a href="{{ .Permalink }}" class="u-url"><time class="dt-published" datetime="{{ .Date.Format "2 Jan 2006 15:04 GMT" }}">{{ .Date.Format "02/01/2006 15:04 GMT" }}</time></a></span><br/>
                              </section>{{ end }}
                        </section>
                      </article>
                      {{end}}
            {{ end }}
      <span id="pagination-bottom">{{ partial "pagination.html" . }}</span>
          </section>


{{ end }}