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
|
{{ 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 }}
|
Loading…
Reference in a new issue