Add both first and last classes when only one page (#43)

This commit is contained in:
Jesper Kolbeck 2021-12-07 16:35:06 +01:00 committed by GitHub
parent 6388e9e916
commit 99dc3365eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,7 +21,7 @@
</div> </div>
{{ range $index_val, $elem_val := $sections }} {{ range $index_val, $elem_val := $sections }}
<div class='post-holder'> <div class='post-holder'>
<article id='{{ anchorize .Title }}' class='post {{ if eq $index_val 0 }}first{{ else }}{{ if eq (add $index_val 1) (len $sections) }}last{{ end }}{{ end }}'> <article id='{{ anchorize .Title }}' class='post {{ if eq $index_val 0 }}first{{ end }} {{ if eq (add $index_val 1) (len $sections) }}last{{ end }}'>
<header class="post-header"> <header class="post-header">
<h2 class="post-title">{{ .Title }}</h2> <h2 class="post-title">{{ .Title }}</h2>
</header> </header>