1
Fork 0

Add list page for blog

This commit is contained in:
Jake Howard 2017-10-25 22:09:16 +01:00
parent 4c11f00c56
commit a0f4a692b5
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 47 additions and 0 deletions

29
layouts/posts/list.html Normal file
View file

@ -0,0 +1,29 @@
{{ define "main" }}
<div id="main">
<div class="container">
{{ $paginator := .Paginate (.Data.Pages.GroupByDate "2006-01") }}
<h1 class="display-4">{{ .Title }}</h1>
{{ range $paginator.PageGroups }}
{{ $month := (print .Key "-01") }}
<h3 class="mt-5">
{{ if ne .Key "0001-01" }}
{{ dateFormat "2006-01" $month }}
{{ end }}
</h3>
{{ range .Pages.ByDate }}
<div class="media list-page-item mb-3">
<div class="d-none d-md-block align-self-center img-wrapper mr-3">
<img src="{{ .Params.image }}" alt="{{ .Title }} image" />
</div>
<div class="media-body">
<a href="{{ .Permalink }}">
<h5 class="mt-0">{{ .Title }}</h5>
</a>
<p>{{ .Summary }}</p>
</div>
</div>
{{ end }}
{{ end }}
</div>
</div>
{{ end }}

View file

@ -118,3 +118,21 @@ footer {
}
}
}
#main {
margin-top: $spacer * 6;
}
.list-page-item {
.img-wrapper {
width: 20%;
}
img {
width: 100%;
}
a {
color: #e89980;
}
}