Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vickylaixy/hugo-theme-introduction.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanzei <hanzei@mailbox.org>2018-07-22 08:24:01 +0300
committerHanzei <hanzei@mailbox.org>2018-07-22 08:24:01 +0300
commit389ac2a34bc72ca503c696c965c2016954441f34 (patch)
tree85803f4ef1f0cee1457b653ed9df61693c1e7e52
parent9b08324593c35da21299ef74cecca7e330efcb20 (diff)
Add projects.useTwoColumns option
-rw-r--r--exampleSite/config.toml10
-rw-r--r--layouts/partials/home/projects.html4
-rw-r--r--layouts/projects/list.html9
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 @@
<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 }}
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 }}
</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 }}