From 19b9131073d1da80cc0193af397d5a1ab267f45d Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Fri, 20 Oct 2023 16:06:53 +0200 Subject: Project single page --- layouts/_default/single.html | 35 ++------------------------ layouts/partials/leading_image.html | 30 ++++++++++++++++++++++ layouts/partials/meta_links.html | 10 ++++++++ layouts/partials/metadata.html | 13 ---------- layouts/partials/post.html | 1 + layouts/project/single.html | 50 +++++++++++++++++++++++++++++++++++++ 6 files changed, 93 insertions(+), 46 deletions(-) create mode 100644 layouts/partials/leading_image.html create mode 100644 layouts/partials/meta_links.html create mode 100644 layouts/project/single.html (limited to 'layouts') 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 @@

{{ . }}

{{ 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 }} -
-
- {{ .Title }} - {{ with $.Params.caption }} - - {{ .text }} - - {{ end }} -
-
- {{ end }} + {{ partial "leading_image.html" . }}
{{ .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 }} +
+
+ {{ .Title }} + {{ with $.Params.caption }} + + {{ .text }} + + {{ end }} +
+
+{{ 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 }} + + {{ $key }} + +{{ 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 }} - - {{ $key }} - -{{ end }} - -

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 @@

+ {{ partial "meta_links.html" . }}

{{ .Title }}

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" -}} +
+

+ {{ .Title }} +

+ + {{ with .Params.subtitle }} +

{{ . }}

+ {{ end }} + + {{ partial "meta_links.html" . }} + {{ partial "leading_image.html" . }} +
+
+ {{ .Content }} +
+ +
+ {{ $page := . }} + {{ $project := .File.ContentBaseName }} + + {{ $items := where (where site.RegularPages "Type" "post") ".Params.projects" "intersect" (slice $project) }} + {{ $count := len $items }} + {{ if ge $count 1 }} +

Related Posts

+ {{ 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 }} +

Related Publications

+ {{ 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 }} +

Related Talks

+ {{ range $index, $item := $items }} + {{ partial "post.html" . }} + {{ end }} + {{ end }} + {{ partial "post_pager" . }} +
+{{- end -}} -- cgit v1.2.3