mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-11-09 23:09:47 +00:00
Add projects.useTwoColumns option
This commit is contained in:
parent
9b08324593
commit
389ac2a34b
3 changed files with 14 additions and 9 deletions
|
@ -22,6 +22,8 @@ DefaultContentLanguage = "en" # Default language fo
|
|||
|
||||
localTime = true # Show your current local time in contact section
|
||||
timeZone = "America/Los_Angeles" # Your timezone as in the TZ* column of this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
[params.projects]
|
||||
useTwoColumns = false # Use a layout with two columns instead of three
|
||||
|
||||
# Share buttons on blog post pages
|
||||
[params.share]
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
<h2 class="title is-2 has-text-centered">
|
||||
{{ .Title }}
|
||||
</h2>
|
||||
<div class="section is-small">
|
||||
<div class="section">
|
||||
<div class="columns is-multiline">
|
||||
{{ $totalProjects := (len .Pages) }}
|
||||
{{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }}
|
||||
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
|
||||
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
|
||||
{{ if .Site.Params.projects.useTwoColumns }}
|
||||
{{ .Scratch.Set "width" "490x" }}
|
||||
<div class="column is-half">
|
||||
{{ else }}
|
||||
|
|
|
@ -3,22 +3,25 @@
|
|||
{{ .Content }}
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="section is-small">
|
||||
<div class="section">
|
||||
<div class="columns is-multiline">
|
||||
{{ $numberOfPages := len .Pages}}
|
||||
{{ range .Pages.ByWeight }}
|
||||
{{ if eq (mod $numberOfPages 2) 0 }}
|
||||
{{ if .Site.Params.projects.useTwoColumns }}
|
||||
{{ .Scratch.Set "width" "490x" }}
|
||||
<div class="column is-half">
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "width" "302x" }}
|
||||
<div class="column is-one-third">
|
||||
{{ end }}
|
||||
<div class="card">
|
||||
<div class="card-image">
|
||||
<figure class="image is-3by2">
|
||||
<a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{ .Permalink }}{{ 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