{{ define "head" }}
{{ end }}
{{ define "main" }}
<main id="index" class="section">
	<div class="container">
		<section class="h-feed">
			{{partial "h-card.html" .}}
			<div style="max-width: 60ch; place-self: center;">
				<h1 class="p-name heading">Latest activity</h1>
				{{$paginator := .Paginate (.Site.RegularPages) 20}}
				{{range $paginator.Pages}}

				{{if eq .Params.type "note" }}
				<article class="h-entry note">
					<header>
						<div class="icon">
							<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"
								fill="currentColor">
								<path fill-rule="evenodd"
									d="M18 3a1 1 0 00-1.447-.894L8.763 6H5a3 3 0 000 6h.28l1.771 5.316A1 1 0 008 18h1a1 1 0 001-1v-4.382l6.553 3.276A1 1 0 0018 15V3z"
									clip-rule="evenodd" />
							</svg>
						</div>
						<span class="description">posted a note</span>
					</header>
					<div class="e-content">{{.Content}}</div>
					{{$permalink := .Page.Permalink}}
					{{ range .Params.attachment }}
					{{if (strings.HasSuffix . "png") | or (strings.HasSuffix . "jpg") | or (strings.HasSuffix . "gif")}}
					<a href='{{printf "%s/%s" $permalink .}}' style="display: block; width: 100px; height: 100px;">
						<img src='{{printf "%s/%s" $permalink .}}' alt="attachment" style="object-fit: contain; width: 100%; height: 100%; background: rgba(0,0,0,0.25)">
					</a>
					{{end}}
					{{end}}

					<p class="meta"><time class="dt-published" datetime="{{.Date}}">{{.Date.Format "January 2, 2006 3:04:05"}}</time></p>
				</article>
				{{end}}

				{{if eq .Params.type "reply"}}
				<article class="h-entry reply">
					<header>
						<div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20"
								fill="currentColor">
								<path fill-rule="evenodd"
									d="M7.707 3.293a1 1 0 010 1.414L5.414 7H11a7 7 0 017 7v2a1 1 0 11-2 0v-2a5 5 0 00-5-5H5.414l2.293 2.293a1 1 0 11-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
									clip-rule="evenodd" />
							</svg></div>
						<span class="description">posted a comment</span>
					</header>
					<h2 class="p-name"><a href="{{.Permalink}}" class="u-url">{{.Title}}</a></h2>
					<p class="p-summary">{{.Summary}}</p>
					<p class="meta">Originally published <time class="dt-published" datetime="{{.Date}}">{{.Date.Format
							"January 2, 2006"}}</time> at <a href="{{.Params.original}}" class="u-syndication">[source]</a> in
						reply to <a href="{{.Params.inReplyTo}}" class="u-in-reply-to">[article]</a></p>

				</article>
				{{end}}
				<hr>
				{{end}}
			</div>
		</section>
	</div>
</main>
{{ end }}