{{ define "partials/list-limited.html" }} {{/* This is not pretty but I'm not good at templates */}} {{ $params := . | transform.Unmarshal (dict "delimiter" ";") }} {{ $fields := index $params 0 }} {{ $pageurl := index $fields 0 }} {{ $pagename := index $fields 1 }} {{ $limit := 5 }} {{ $pages := where site.RegularPages "Section" $pageurl }} {{- with $pages }} <section class="post-list"> <h2>Latest {{$pagename}}</h2> {{- range ( $pages | first $limit ) }} <article> <time datetime='{{ .Date | time.Format "2006-01-02"}}' >{{ .Date | time.Format "2006-01-02"}}</time > <a class="title" href="{{ .RelPermalink }}">{{ .Title }}</a> </article> {{ end }} {{ if (gt ($pages | len) $limit )}} <a href="/{{ $pageurl }}/">See moreā¦</a> {{ end }} </section> {{ end }} {{ end }} {{ define "main" }} <header class="site-header"> <h1 class="title">Hello, this is a webpage</h1> </header> <section class="intro"> <p> I'm a random internet dude and I figured that if I wrote something on the Internet then someone might read it, also I needed a website cause everyone got one of those! </p> <h2>What's in this desperate corner of the net?</h2> <p> Mostly my blog where I try to discuss and review things and other resources that I've been publishing all over the place and are in dire need of a more permanent home. Check the links at the top or look below for the latest posts! </p> <h3>Miscellaneous link collection of ultimate destiny</h3> <p> Find me at any of these places: {{ range $name, $link := $.Site.Data.home.links }} <span class="home-link"><a href="{{ $link }}">{{ $name }}</a></span> {{ end }} </p> </section> <section class="post-list"> <h2>Browse by series</h2> {{ range $link, $name := $.Site.Data.home.series }} <article><a href="{{ $link }}">{{ $name }}</a></article> {{ end }} </section> {{ partial "list-limited.html" "posts;posts" }} {{ partial "list-limited.html" "pages;pages" }} {{ end }}