diff options
-rw-r--r-- | layouts/_default/single.html | 35 | ||||
-rw-r--r-- | layouts/partials/leading_image.html | 30 | ||||
-rw-r--r-- | layouts/partials/meta_links.html | 10 | ||||
-rw-r--r-- | layouts/partials/metadata.html | 13 | ||||
-rw-r--r-- | layouts/partials/post.html | 1 | ||||
-rw-r--r-- | layouts/project/single.html | 50 |
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 -}} |