mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-12-22 22:52:54 +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 }}
|
{{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }}
|
||||||
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
|
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
|
||||||
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
|
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
|
||||||
|
{{ .Scratch.Set "width" "490x" }}
|
||||||
<div class="column is-half">
|
<div class="column is-half">
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
{{ .Scratch.Set "width" "302x" }}
|
||||||
<div class="column is-one-third">
|
<div class="column is-one-third">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="card" data-target="#project-{{ $index }}">
|
<div class="card" data-target="#project-{{ $index }}">
|
||||||
<div class="card-image">
|
<div class="card-image">
|
||||||
<figure class="image is-3by2">
|
<figure class="image is-3by2">
|
||||||
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
|
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
|
||||||
|
{{ $width := ( .Scratch.Get "width" ) }}
|
||||||
{{ with .Resources.ByType "image" }}
|
{{ with .Resources.ByType "image" }}
|
||||||
{{ range first 1 (sort . "Params.weight") }}
|
{{ range first 1 (sort . "Params.weight") }}
|
||||||
{{ $image := .Resize "302x" }}
|
{{ $image := .Resize $width }}
|
||||||
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
|
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue