58 lines
1.7 KiB
HTML
58 lines
1.7 KiB
HTML
{{ define "main" }}
|
|
|
|
<!-- Main Title -->
|
|
{{ if .Title }}
|
|
<h1 class="mb-24">{{ .Title }}</h1>
|
|
{{ end }}
|
|
|
|
<!-- $pages -->
|
|
{{ $pages := union .RegularPages .Sections }}<!---->
|
|
{{ if .IsHome }}<!---->
|
|
{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections }}<!---->
|
|
{{ end }}
|
|
|
|
<!-- Articles -->
|
|
{{ $paginator := .Paginate $pages }} {{ range $index, $page := $paginator.Pages }}<!---->
|
|
|
|
<!-- avatar -->
|
|
{{ if and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0) }}<!---->
|
|
|
|
{{ $avatar_url := $.Scratch.Get `avatar_url` }}<!---->
|
|
{{ if or $avatar_url site.Params.name }}
|
|
<div class="-mt-4 mb-20 flex">
|
|
{{ if $avatar_url }}
|
|
<div class="mr-5 h-20 w-20 rounded-full border border-black/10 bg-white/80 p-3 shadow-xl">
|
|
<img class="my-0 rounded-full hover:animate-spin" src="{{ $avatar_url }}" alt="avatar" />
|
|
</div>
|
|
{{ end }}<!---->
|
|
{{ if site.Params.name }}
|
|
<div>
|
|
<h1 class="mt-1 mb-3 text-3xl font-bold">{{ site.Params.name }}</h1>
|
|
<div class="">{{ site.Params.bio | default (print "Personal blog by " site.Params.name) }}</div>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
{{ end }}<!---->
|
|
|
|
{{ end }}
|
|
|
|
<article class="relative my-10 first-of-type:mt-0 last-of-type:mb-0">
|
|
<h2 class="!my-0 pb-1 !leading-none">{{ .Title }}</h2>
|
|
<time class="text-sm opacity-70">{{ .Date | time.Format ":date_medium" }}</time>
|
|
<a class="absolute inset-0" href="{{ .Permalink }}"></a>
|
|
</article>
|
|
{{ end }}
|
|
|
|
<!-- Main Nav -->
|
|
{{ if gt $paginator.TotalPages 1 }}
|
|
<nav class="mt-24 flex">
|
|
{{ if $paginator.HasPrev }}
|
|
<a class="btn" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a>
|
|
{{ end }}<!---->
|
|
{{ if $paginator.HasNext }}
|
|
<a class="btn ml-auto" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a>
|
|
{{ end }}
|
|
</nav>
|
|
{{ end }}<!---->
|
|
|
|
{{ end }}
|