feat: add introduction

This commit is contained in:
2025-10-21 16:36:22 +05:30
parent a462613e43
commit ff8b6587f8
4 changed files with 104 additions and 0 deletions

38
layouts/index.html Normal file
View File

@@ -0,0 +1,38 @@
{{ define "main" }}
<section>
<h1>{{ .Title }}</h1>
{{ .Content }}
</section>
{{ $posts := sort (where .Site.RegularPages "Type" "posts") "Date" "desc" }}
{{ if gt (len $posts) 0 }}
<hr>
<section>
<h2>Latest Posts</h2>
{{ $paginator := .Paginate $posts 5 }}
<ul>
{{ range $paginator.Pages }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
<small>({{ .Date.Format "Jan 2, 2006" }})</small>
</li>
{{ end }}
</ul>
<!-- Pagination controls -->
{{ if or $paginator.HasPrev $paginator.HasNext }}
<nav class="pagination">
{{ if $paginator.HasPrev }}
<a href="{{ $paginator.Prev.URL }}">← Newer</a>
{{ end }}
{{ if $paginator.HasNext }}
<a href="{{ $paginator.Next.URL }}">Older →</a>
{{ end }}
</nav>
{{ end }}
</section>
{{ end }}
{{ end }}