From 389ac2a34bc72ca503c696c965c2016954441f34 Mon Sep 17 00:00:00 2001 From: Hanzei Date: Sun, 22 Jul 2018 07:24:01 +0200 Subject: Add projects.useTwoColumns option --- exampleSite/config.toml | 10 ++++++---- layouts/partials/home/projects.html | 4 ++-- layouts/projects/list.html | 9 ++++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 753d547..29d3ee7 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -22,13 +22,15 @@ 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] - twitter = true - facebook = true - googlePlus = true - pinterest = true + twitter = true + facebook = true + googlePlus = true + pinterest = true # Social icons appear in introduction and contact section. Add as many more as you like. # Find icon names here: https://fontawesome.com/cheatsheet/ diff --git a/layouts/partials/home/projects.html b/layouts/partials/home/projects.html index a6e82d7..afd9e20 100644 --- a/layouts/partials/home/projects.html +++ b/layouts/partials/home/projects.html @@ -5,12 +5,12 @@

{{ .Title }}

-
+
{{ $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" }}
{{ else }} diff --git a/layouts/projects/list.html b/layouts/projects/list.html index f2becc8..a4f6e1a 100644 --- a/layouts/projects/list.html +++ b/layouts/projects/list.html @@ -3,22 +3,25 @@ {{ .Content }}
-
+
{{ $numberOfPages := len .Pages}} {{ range .Pages.ByWeight }} - {{ if eq (mod $numberOfPages 2) 0 }} + {{ if .Site.Params.projects.useTwoColumns }} + {{ .Scratch.Set "width" "490x" }}