Created summary block with thumbnails for content pages

This commit is contained in:
Warwick 2023-10-24 17:58:58 +01:00
parent b4acd074ca
commit a9645f3455
4 changed files with 33 additions and 41 deletions

View file

@ -1,6 +1,7 @@
--- ---
title: "Hello World!" title: "Hello World!"
date: 2023-10-15 20:25:14.038 +0100 date: 2023-10-15 20:25:14.038 +0100
thumbnail: /img/fof.png
--- ---
# Hello World! # Hello World!

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -0,0 +1,23 @@
<div class="item">
<div style="justify-content: space-between" class="flex-wrap-container">
<div class="summary">
<a class="summary__link" href="{{ .Permalink }}">
<h4>{{ .Title }}</h4>
</a>
<p>{{.Summary}}</p>
<span class="summary__date">
{{.Params.date.Format "2 January 2006"}}
</span>
</div>
<div>
{{ if .Params.thumbnail }}
{{- $image := resources.Get .Params.thumbnail -}}
<a style="display: block" href="{{ .Permalink }}">
<img src="{{ ($image.Fill "200x200 q100 Center").RelPermalink }}">
</a>
{{ end }}
</div>
</div>
<hr>
</div>

View file

@ -10,65 +10,33 @@
<div class="flex-wrap-container"> <div class="flex-wrap-container">
<div class="container"> <div class="container">
<h2>Projects</h2> <h2>Projects</h2>
<hr>
{{ range where .Site.RegularPages "Type" "projects" }} {{ range where .Site.RegularPages "Type" "projects" }}
<div class="index-article"> {{ .Render "summary" }}
<a class="index-article__link" href="{{ .Permalink }}">
<h4>{{ .Title }}</h4>
</a>
<p>{{.Summary}}</p>
<span class="index-article__date">
{{.Params.date.Format "2 January 2006"}}
</span>
<hr>
</div>
{{ end }} {{ end }}
</div> </div>
<div class="container"> <div class="container">
<h2>Blog</h2> <h2>Blog</h2>
<hr>
{{ range where .Site.RegularPages "Type" "posts" }} {{ range where .Site.RegularPages "Type" "posts" }}
<div class="index-article"> {{ .Render "summary" }}
<a class="index-article__link" href="{{ .Permalink }}">
<h4>{{ .Title }}</h4>
</a>
<p>{{.Summary}}</p>
<span class="index-article__date">
{{.Params.date.Format "2 January 2006"}}
</span>
<hr>
</div>
{{ end }} {{ end }}
</div> </div>
<div class="container"> <div class="container">
<h2>Papers</h2> <h2>Research Papers</h2>
<hr>
{{ range where .Site.RegularPages "Type" "papers" }} {{ range where .Site.RegularPages "Type" "papers" }}
<div class="index-article"> {{ .Render "summary" }}
<a class="index-article__link" href="{{ .Permalink }}">
<h4>{{ .Title }}</h4>
</a>
<p>{{.Summary}}</p>
<span class="index-article__date">
{{.Params.date.Format "2 January 2006"}}
</span>
<hr>
</div>
{{ end }} {{ end }}
</div> </div>
<div class="container"> <div class="container">
<h2>Articles</h2> <h2>Articles</h2>
<hr>
{{ range where .Site.RegularPages "Type" "articles" }} {{ range where .Site.RegularPages "Type" "articles" }}
<div class="index-article"> {{ .Render "summary" }}
<a class="index-article__link" href="{{ .Permalink }}">
<h4>{{ .Title }}</h4>
</a>
<p>{{.Summary}}</p>
<span class="index-article__date">
{{.Params.date.Format "2 January 2006"}}
</span>
<hr>
</div>
{{ end }} {{ end }}
</div> </div>