hugo-theme-introduction/layouts/projects/list.html
Crt Mori 34761ba2b2
Use image on home for projects only when project has an image (#288)
* Use image only when project has an image

So if there is no images, then projects can form a bit tigher and more
centered position in a square.

* Use same principle for all projects listing template

As per the review comment the listing of the projects would also be dependent on the existance of the image and creation of the space for it
2021-03-20 06:55:05 -04:00

43 lines
1.9 KiB
HTML

{{ define "main" }}
<div class="container markdown top-pad">
{{ .Content }}
</div>
<div class="container">
<div class="section">
<div class="columns is-multiline">
{{ $numberOfPages := len .Pages}}
{{ range .Pages.ByWeight }}
{{ $width := "302x" }}
{{ $columWidth := "is-one-third" }}
{{ if .Site.Params.projects.useTwoColumns }}
{{ $columWidth = "is-half" }}
{{ $width = "490x" }}
{{ end}}
<div class="column {{ $columWidth }}">
<div class="card">
{{ if .Resources.ByType "image" }}
<div class="card-image">
<figure class="image is-3by2">
<a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{ .Permalink }}{{ end }}">
{{ with .Resources.ByType "image" }}
{{ range first 1 (sort . "Params.weight") }}
{{ $image := .Resize $width }}
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
{{ end }}
{{ end }}
</a>
</figure>
</div>
{{ end }}
<div class="card-content has-text-centered top-pad">
<a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{ .Permalink }}{{ end }}">
{{ .Title | markdownify }}
</a>
</div>
</div>
</div>
{{ end }}
</div>
</div>
</div>
{{ end }}