1
0
Fork 0

reformat index
All checks were successful
Deploy to Artifacts / deploy (push) Successful in 14s

This commit is contained in:
Hamcha 2024-10-12 11:58:17 +02:00
parent b954afdd3a
commit 6bb924eddf
Signed by: hamcha
GPG key ID: 1669C533B8CF6D89

View file

@ -1,22 +1,28 @@
{{ define "partials/list-limited.html" }} {{/* This is not pretty but I'm not {{ define "partials/list-limited.html" }}
good at templates */}} {{ $params := . | transform.Unmarshal (dict "delimiter" {{/* This is not pretty but I'm not good at templates */}}
";") }} {{ $fields := index $params 0 }} {{ $pageurl := index $fields 0 }} {{ {{ $params := . | transform.Unmarshal (dict "delimiter" ";") }}
$pagename := index $fields 1 }} {{ $limit := 5 }} {{ $pages := where {{ $fields := index $params 0 }}
site.RegularPages "Section" $pageurl }} {{- with $pages }} {{ $pageurl := index $fields 0 }}
{{ $pagename := index $fields 1 }}
{{ $limit := 5 }}
{{ $pages := where site.RegularPages "Section" $pageurl }}
{{- with $pages }}
<section class="post-list"> <section class="post-list">
<h2>Latest {{$pagename}}</h2> <h2>Latest {{$pagename}}</h2>
{{- range ( $pages | first $limit ) }} {{- range ( $pages | first $limit ) }}
<article> <article>
<time datetime='{{ .Date | time.Format "2006-01-02"}}' <time datetime='{{ .Date | time.Format "2006-01-02"}}'>{{ .Date | time.Format "2006-01-02"}}</time>
>{{ .Date | time.Format "2006-01-02"}}</time
>
<a class="title" href="{{ .RelPermalink }}">{{ .Title }}</a> <a class="title" href="{{ .RelPermalink }}">{{ .Title }}</a>
</article> </article>
{{ end }} {{ if (gt ($pages | len) $limit )}}
<a href="/{{ $pageurl }}/">See more…</a>
{{ end }} {{ end }}
{{ if (gt ($pages | len) $limit )}}<a href="/{{ $pageurl }}/">See more…</a>{{ end }}
</section> </section>
{{ end }} {{ end }} {{ define "main" }} {{ end }}
{{ end }}
{{ define "main" }}
<header class="site-header"> <header class="site-header">
<h1 class="title">Hello, this is a webpage</h1> <h1 class="title">Hello, this is a webpage</h1>
</header> </header>
@ -48,5 +54,8 @@ site.RegularPages "Section" $pageurl }} {{- with $pages }}
<article><a href="{{ $link }}/">{{ $name }}</a></article> <article><a href="{{ $link }}/">{{ $name }}</a></article>
{{ end }} {{ end }}
</section> </section>
{{ partial "list-limited.html" "posts;posts" }} {{ partial "list-limited.html"
"pages;pages" }} {{ end }} {{ partial "list-limited.html" "posts;posts" }}
{{ partial "list-limited.html" "pages;pages" }}
{{ end }}