aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2023-10-20 16:06:53 +0200
committerOscar Najera <hi@oscarnajera.com>2023-10-20 16:32:48 +0200
commit19b9131073d1da80cc0193af397d5a1ab267f45d (patch)
tree6b248ec4b9a279c8d381cf5b2000c1f532652e82
parent0b60f218c1cf0aac57473e0643aedfad1698b5e4 (diff)
downloadhugo-minimalist-theme-19b9131073d1da80cc0193af397d5a1ab267f45d.tar.gz
hugo-minimalist-theme-19b9131073d1da80cc0193af397d5a1ab267f45d.tar.bz2
hugo-minimalist-theme-19b9131073d1da80cc0193af397d5a1ab267f45d.zip
Project single page
-rw-r--r--layouts/_default/single.html35
-rw-r--r--layouts/partials/leading_image.html30
-rw-r--r--layouts/partials/meta_links.html10
-rw-r--r--layouts/partials/metadata.html13
-rw-r--r--layouts/partials/post.html1
-rw-r--r--layouts/project/single.html50
6 files changed, 93 insertions, 46 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 076e4e7..0dd0817 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -8,43 +8,12 @@
<h3 class="f3 baskerville mv3 pa1">{{ . }}</h3>
{{ end }}
+ {{ partial "meta_links.html" . }}
{{ if in (slice "post" "talk" "publication") .Section }}
{{ partial "metadata.html" . }}
{{ end }}
- {{ $image := "" }}
- {{ if (.Resources.ByType "image").GetMatch "*featured*" }}
- {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }}
- {{ else if resources.Get (index .Params.images 0) }}
- {{ $image = resources.Get (index .Params.images 0) }}
- {{ end }}
- {{ with $image }}
- {{ if ne $image.MediaType.SubType "svg" }}
- {{ $image := .Fit (default "400x400" $.Params.image_size) }}
- {{ end }}
- <div class="tc">
- <div class="relative dib">
- <img
- src="{{ if ne .MediaType.SubType "svg" }}
- {{ $image := .Fit (default "400x400" $.Params.image_size) }}
- {{ $image.RelPermalink }}
- {{ else }}
- {{ $image.RelPermalink }}
- {{ end }}"
- class="ma0"
- alt="{{ .Title }}"
- />
- {{ with $.Params.caption }}
- <a
- href="{{ .url }}"
- class="link near-white db absolute bottom-0 right-0 pa2 bg-black-30 br2"
- >
- {{ .text }}
- </a>
- {{ end }}
- </div>
- </div>
- {{ end }}
+ {{ partial "leading_image.html" . }}
</header>
<div class="main-content mw7 center lh-copy f5 f4-ns ph1">
{{ .Content }}
diff --git a/layouts/partials/leading_image.html b/layouts/partials/leading_image.html
new file mode 100644
index 0000000..ac528d3
--- /dev/null
+++ b/layouts/partials/leading_image.html
@@ -0,0 +1,30 @@
+{{ $image := "" }}
+{{ if (.Resources.ByType "image").GetMatch "*featured*" }}
+ {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }}
+{{ else if resources.Get (index .Params.images 0) }}
+ {{ $image = resources.Get (index .Params.images 0) }}
+{{ end }}
+{{ with $image }}
+ <div class="tc">
+ <div class="relative dib">
+ <img
+ src="{{ if ne .MediaType.SubType "svg" }}
+ {{ $image := .Fit (default "768x400" $.Params.image_size) }}
+ {{ $image.RelPermalink }}
+ {{ else }}
+ {{ $image.RelPermalink }}
+ {{ end }}"
+ class="ma0"
+ alt="{{ .Title }}"
+ />
+ {{ with $.Params.caption }}
+ <a
+ href="{{ .url }}"
+ class="link near-white db absolute bottom-0 right-0 pa2 bg-black-30 br2"
+ >
+ {{ .text }}
+ </a>
+ {{ end }}
+ </div>
+ </div>
+{{ end }}
diff --git a/layouts/partials/meta_links.html b/layouts/partials/meta_links.html
new file mode 100644
index 0000000..00afc71
--- /dev/null
+++ b/layouts/partials/meta_links.html
@@ -0,0 +1,10 @@
+{{ range $key, $val := .Params.meta_links }}
+ <a
+ class="fr f6 link ba br3 ma2 ph2 pv1 dib w3-text-theme w3-hover-theme ttu"
+ href="{{ . }}"
+ target="_blank"
+ rel="noopener"
+ >
+ {{ $key }}
+ </a>
+{{ end }}
diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html
index d34c3a8..fdbb504 100644
--- a/layouts/partials/metadata.html
+++ b/layouts/partials/metadata.html
@@ -1,18 +1,5 @@
{{ $dateTime := .PublishDate.Format "2006-01-02" }}
{{ $dateFormat := .Site.Params.dateFormat | default "Jan 2, 2006" }}
-
-{{ range $key, $val := .Params.meta_links }}
- <a
- class="fr f6 link ba br3 ma2 ph2 pv1 dib w3-text-theme w3-hover-theme ttu"
- href="{{ . }}"
- target="_blank"
- rel="noopener"
- >
- {{ $key }}
- </a>
-{{ end }}
-
-
<p class="f6 lh-copy mv0 ph4 pv2">
By
{{ with .Params.author }}
diff --git a/layouts/partials/post.html b/layouts/partials/post.html
index b84ba92..768755d 100644
--- a/layouts/partials/post.html
+++ b/layouts/partials/post.html
@@ -1,4 +1,5 @@
<article class="pv4 bt bb b--black-10">
+ {{ partial "meta_links.html" . }}
<a class="db no-underline dim near-black" href="{{ .RelPermalink }}">
<h3 class="f3 baskerville mt0 lh-title">{{ .Title }}</h3>
<div class="cf">
diff --git a/layouts/project/single.html b/layouts/project/single.html
new file mode 100644
index 0000000..eacb6d1
--- /dev/null
+++ b/layouts/project/single.html
@@ -0,0 +1,50 @@
+{{- define "main" -}}
+ <header class="mw7 center">
+ <h2 class="baskerville f2 lh-title mv3 ph1">
+ {{ .Title }}
+ </h2>
+
+ {{ with .Params.subtitle }}
+ <h3 class="f3 baskerville mv3 pa1">{{ . }}</h3>
+ {{ end }}
+
+ {{ partial "meta_links.html" . }}
+ {{ partial "leading_image.html" . }}
+ </header>
+ <div class="main-content mw7 center lh-copy f5 f4-ns ph1">
+ {{ .Content }}
+ </div>
+
+ <div class="mw7 center ph1">
+ {{ $page := . }}
+ {{ $project := .File.ContentBaseName }}
+
+ {{ $items := where (where site.RegularPages "Type" "post") ".Params.projects" "intersect" (slice $project) }}
+ {{ $count := len $items }}
+ {{ if ge $count 1 }}
+ <h2 class="f2 fw3 ma0">Related Posts</h2>
+ {{ range $index, $item := $items }}
+ {{ partial "post.html" . }}
+ {{ end }}
+ {{ end }}
+
+ {{ $items := where (where site.RegularPages "Type" "publication") ".Params.projects" "intersect" (slice $project) }}
+ {{ $pubs_len := len $items }}
+ {{ if ge $pubs_len 1 }}
+ <h2 class="f2 fw3 ma0">Related Publications</h2>
+ {{ range $index, $item := $items }}
+ {{ partial "post.html" . }}
+ {{ end }}
+ {{ end }}
+
+ {{ $items := where (where site.RegularPages "Type" "event") ".Params.projects" "intersect" (slice $project) }}
+ {{ $talks_len := len $items }}
+ {{ if ge $talks_len 1 }}
+ <h2 class="f2 fw3 ma0">Related Talks</h2>
+ {{ range $index, $item := $items }}
+ {{ partial "post.html" . }}
+ {{ end }}
+ {{ end }}
+ {{ partial "post_pager" . }}
+ </div>
+{{- end -}}