mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-09 23:09:47 +00:00
Fix width of images on homepage
This commit is contained in:
parent
0de42476ae
commit
68d795ed4d
7 changed files with 4 additions and 1 deletions
|
@ -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 }}
|
||||
|
|
Loading…
Reference in a new issue