{{ define "main" }}
<section class="about h-feed">
  <section class="profile title h-card p-author">
      <section class="profile-left"><img class="u-photo" src="/images/profile.jpg" alt="profile picture"></section>
      <section class="profile-right">
      <a rel="author" class="title p-name u-url u-uid" rel="me" href="https://jk.nipponalba.scot">{{ .Site.Params.Author }}</a><br/>
        <ul class="social-links">
          {{ range $item := .Site.Params.socialIcons }}
          <a href="{{ $item.url | safeURL }}" rel="me" >
            <i class="fa {{ $item.icon }}" aria-hidden="true" title="{{ $item.title }}"></i>
          </a>
          {{ end }}
      </ul>
      <section class="description">
        <p class="p-note">{{ .Site.Params.description }}</p>
      </section>
      </section>
      <section style="display:none">
      <span class="p-country-name">Scotland or Japan</span>
      <a class="u-email" rel="me" href="mailto:jk@nipponalba.scot"></a>
      <a class="u-url" rel="me" href="https://social.nipponalba.scot/jk"></a>
      <a class="u-url" rel="me" href="https://px.nipponalba.scot/jk"></a>
      <span class="p-category">Craft Beer</span>
      <span class="p-category">Single Malt Whisky</span>
      <span class="p-category">Homebrewing</span>
      <span class="p-category">Scottish Politics</span>
      <span class="p-category">Scottish History</span>
      <span class="p-category">Japanese History</span>
      <span class="p-category">Tech</span>
      <span class="p-category">Veganism</span>
      <span class="p-category">Cooking</span>
      </section>
</section>
    <h1>Latest posts</h1>
    {{ range (first 3 (where .Site.RegularPages "Type" "!=" "response")) }}
    <article class="post h-entry entry">
        {{ if eq .Type "article"}}{{ with .Page.Params.images }}{{ partial "taxonomy/image.html" . }}{{ end }}<h3 class="p-name entry-title"><a href="{{ .Permalink}}" class="u-url">{{ .Title }}</a></h3>{{ end }}
    <section class="e-content">{{ if not (eq .Type "article")}}{{ .Content }}{{ else}}{{ .Summary }}{{ 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="{{ replace .value "800." "600."}}" title="{{ .alt }}" alt="{{ .alt }}"/></a>
          {{ else }}
          <a href="{{ $link }}" class="u-url"><img class="u-photo thumb" src="{{ replace . "800." "600."}}" title="{{ $summary }}" alt="Alt not yet added, will fix!"/></a>
          {{ end }}
        {{end}}
        </section>
        {{end}}
    </section>
    <section class="info">
      {{ if eq .Type "article" }}
      <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>
      {{ else }}
      {{ $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>

      {{ end }}
    </section>
<a href="https://brid.gy/publish/mastodon"></a>
</article>
    {{ end }}
</section>
{{ end }}