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

github.com/2-REC/hugo-myportfolio-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Severin <severinderek@gmail.com>2022-02-04 09:44:00 +0300
committerDerek Severin <severinderek@gmail.com>2022-02-04 09:44:00 +0300
commit6661cb5267643b6f7b89c53e45775de0d38c41e3 (patch)
treec6f2b5500ea4f7e0ce5eb30648d6ed2e94a623f4
parentf4a2b4bd428734e160b46026e8dbb661cf353caa (diff)
Project boxes from pages instead of sections
-rw-r--r--archetypes/default.md11
-rw-r--r--layouts/partials/project-image.html39
-rw-r--r--layouts/partials/sections/projects.html6
3 files changed, 42 insertions, 14 deletions
diff --git a/archetypes/default.md b/archetypes/default.md
index 8cde49d..efd61ff 100644
--- a/archetypes/default.md
+++ b/archetypes/default.md
@@ -2,6 +2,17 @@
# Template for projects.
title: "<PROJECT_NAME>"
subtitle: "<CATCH_PHRASE>"
+##
+# Only if direct from home (no subsection)
+#cover_image: "<IMAGE_FILE>"
+#subtitle2: "<SMALL_CATCH_PHRASE>"
+#startDate: "2016-12-01"
+#endDate: "2017-09-01"
+#show_title: false
+#show_subtitle: false
+#show_subtitle2: false
+#show_date: false
+##
#image: "<IMAGE_FILE>"
#small_image: "<IMAGE_FILE>"
#small_url: "<URL>"
diff --git a/layouts/partials/project-image.html b/layouts/partials/project-image.html
index 5bb3616..fbfe791 100644
--- a/layouts/partials/project-image.html
+++ b/layouts/partials/project-image.html
@@ -44,21 +44,38 @@
{{ end }}
<div class="project-box-caption">
<div class="project-box-caption-content">
+{{/* TODO: Adapt size of fonts of each element depending on number of elements */}}
+ {{ $show_title := false }}
+ {{ if and .context.Title (ne .context.Params.show_title false) }}
+ {{ $show_title = true }}
+ {{ end }}
+ {{ $show_subtitle := false }}
+ {{ if and .context.Params.subtitle (ne .context.Params.show_subtitle false) }}
+ {{ $show_subtitle = true }}
+ {{ end }}
+ {{ $show_subtitle2 := false }}
+ {{ if and .context.Params.subtitle2 (ne .context.Params.show_subtitle2 false) }}
+ {{ $show_subtitle2 = true }}
+ {{ end }}
+ {{ $show_date := false }}
+ {{ if and (isset .context.Params "startdate") (ne .context.Params.show_date false) }}
+ {{ $show_date = true }}
+ {{ end }}
{{ if .context.Params.title_image }}
{{ $image_file := or .context.Params.cover_image .context.Params.title_image }}
{{ if $image_file }}
{{/* Determine size of image depending on number of elements */}}
{{ $nb_elements := 0 }}
- {{ if .context.Title }}
+ {{ if $show_title }}
{{ $nb_elements = add $nb_elements 1 }}
{{ end }}
- {{ if .context.Params.subtitle }}
+ {{ if $show_subtitle }}
{{ $nb_elements = add $nb_elements 1 }}
{{ end }}
- {{ if .context.Params.subtitle2 }}
+ {{ if $show_subtitle2 }}
{{ $nb_elements = add $nb_elements 1 }}
{{ end }}
- {{ if .context.Params.startDate }}
+ {{ if $show_date }}
{{ $nb_elements = add $nb_elements 1 }}
{{ end }}
{{ $size := "full" }}
@@ -75,22 +92,22 @@
{{ end }}
{{ end }}
{{ end }}
- {{ with .context.Title }}
+ {{ if $show_title }}
<div class="project-name">
- {{ . }}
+ {{ .context.Title }}
</div>
{{ end }}
- {{ with .context.Params.subtitle }}
+ {{ if $show_subtitle }}
<div class="project-category">
- {{ . }}
+ {{ .context.Params.subtitle }}
</div>
{{ end }}
- {{ with .context.Params.subtitle2 }}
+ {{ if $show_subtitle2 }}
<div class="project-category2">
- {{ . }}
+ {{ .context.Params.subtitle2 }}
</div>
{{ end }}
- {{ if .context.Params.startDate }}
+ {{ if $show_date }}
<div class="project-date">
{{ partial "time-period.html" (dict "startDate" .context.Params.startDate "endDate" .context.Params.endDate) }}
</div>
diff --git a/layouts/partials/sections/projects.html b/layouts/partials/sections/projects.html
index d3c410d..29d55c5 100644
--- a/layouts/partials/sections/projects.html
+++ b/layouts/partials/sections/projects.html
@@ -8,9 +8,9 @@
{{ end }}
<div class="container-fluid">
<div class="row no-gutter">
- {{ if .Sections }}
- {{/* Sort the list */}}
- {{ partial "utils/ordered-list.html" (dict "list" .Sections "params" .Params "scratch" .Scratch) }}
+{{/* TODO: Could add param "sections_only" and get ".Sections" instead of ".Pages" */}}
+ {{ if .Pages }}
+ {{ partial "utils/ordered-list.html" (dict "list" .Pages "params" .Params "scratch" .Scratch) }}
{{ $projects := .Scratch.Get "list" }}
{{ $max := len $projects }}
{{ if and $params.max_projects (lt $params.max_projects $max) }}