next/previous article/project section rewritten

This commit is contained in:
Vrifox 2020-09-22 14:10:53 +02:00
parent 8f44f2d329
commit fb24b7e480
7 changed files with 46 additions and 97 deletions

View file

@ -36,34 +36,14 @@
</article>
</section>
<section class="section-articles">
{{ with .PrevInSection }}
<a href="{{ .Permalink }}">
<article>
<h1>{{ .Title }}</h1>
<p class="meta" title="{{ .Date.Format "2 Jan 2006, 15:04 MST" }}"><span class="date">{{ .Date.Format "2 January 2006" }}</span> <span class="author">{{ with .Params.author }}by{{ end}} {{ .Params.author }}</span></p>
{{ with .Description }}
<p>{{ . }}</p>
{{ end }}
{{ with .Params.featured_image }}
<img src="{{ . | relURL }}">
{{ end }}
</article>
</a>
{{ end }}
{{ with .NextInSection }}
<a href="{{ .Permalink }}">
<article>
<h1>{{ .Title }}</h1>
<p class="meta" title="{{ .Date.Format "2 Jan 2006, 15:04 MST" }}"><span class="date">{{ .Date.Format "2 January 2006" }}</span> <span class="author">{{ with .Params.author }}by{{ end }} {{ .Params.author }}</span></p>
{{ with .Description }}
<p>{{ . }}</p>
{{ end }}
{{ with .Params.featured_image }}
<img src="{{ . | relURL }}">
{{ end }}
</article>
</a>
{{ end }}
<article class="next-article">
{{ with .NextInSection }}<span>{{ if eq .Params.type "project" }}next project{{ end }}{{ if ne .Params.type "project" }}next article{{ end }}</span>
<a href="{{ .Permalink }}">{{ .Title }}</a>{{ end }}
</article>
<article class="previous-article">
{{ with .PrevInSection }}<span>{{ if eq .Params.type "project" }}previous project{{ end }}{{ if ne .Params.type "project" }}previous article{{ end }}</span>
<a href="{{ .Permalink }}">{{ .Title }}</a>{{ end }}
</article>
</section>
</div>
</main>