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
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 }}
{{ 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
>
<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 }}
{{ if (gt ($pages | len) $limit )}}<a href="/{{ $pageurl }}/">See more…</a>{{ end }}
</section>
{{ end }} {{ end }} {{ define "main" }}
{{ end }}
{{ end }}
{{ define "main" }}
<header class="site-header">
<h1 class="title">Hello, this is a webpage</h1>
</header>
@ -48,5 +54,8 @@ site.RegularPages "Section" $pageurl }} {{- with $pages }}
<article><a href="{{ $link }}/">{{ $name }}</a></article>
{{ end }}
</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 }}