This commit is contained in:
parent
b954afdd3a
commit
6bb924eddf
1 changed files with 22 additions and 13 deletions
|
@ -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 }}
|
Loading…
Reference in a new issue