Fix width of images on homepage

This commit is contained in:
Hanzei 2018-07-21 10:32:38 +02:00
parent 0de42476ae
commit 68d795ed4d
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
7 changed files with 4 additions and 1 deletions

View file

@ -11,17 +11,20 @@
{{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }}
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
{{ .Scratch.Set "width" "490x" }}
<div class="column is-half">
{{ else }}
{{ .Scratch.Set "width" "302x" }}
<div class="column is-one-third">
{{ end }}
<div class="card" data-target="#project-{{ $index }}">
<div class="card-image">
<figure class="image is-3by2">
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
{{ $width := ( .Scratch.Get "width" ) }}
{{ with .Resources.ByType "image" }}
{{ range first 1 (sort . "Params.weight") }}
{{ $image := .Resize "302x" }}
{{ $image := .Resize $width }}
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
{{ end }}
{{ end }}