From 8982737cbccdac6aaa2dd5dfbd6835043814fb25 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Sat, 8 Oct 2022 23:33:41 -0400 Subject: [PATCH] Added theme for inaturalist observation showcase --- layouts/observations/list.html | 24 ++++++++++++++++++ layouts/observations/single.html | 42 ++++++++++++++++++++++++++++++++ layouts/partials/inat.html | 41 +++++++++++++++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 layouts/observations/list.html create mode 100644 layouts/observations/single.html create mode 100644 layouts/partials/inat.html diff --git a/layouts/observations/list.html b/layouts/observations/list.html new file mode 100644 index 0000000..1ad40d9 --- /dev/null +++ b/layouts/observations/list.html @@ -0,0 +1,24 @@ +{{ define "main"}} + {{ partial "header.html" . }} +
+ + {{ .Content }} + {{ $listPageDateFormat := .Site.Params.listPageDateFormat | default "January, 2006"}} + {{ range $index, $value := .Pages.GroupByDate $listPageDateFormat }} + {{ range .Pages }} + {{ $dataJ := dict "created_at" .Date + "url" .Params.syndication + "quality_grade" .Params.quality_grade + "place_guess" .Params.place_guess + "photos" .Params.photos + "taxon" .Params.taxon + }} + + {{ .Scratch.Set "obs" $dataJ }} + {{ .Scratch.Set "obs_url" .Permalink }} + {{ partial "inat.html" . }} + {{ end }} + {{ end }} +
+ {{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/observations/single.html b/layouts/observations/single.html new file mode 100644 index 0000000..7556023 --- /dev/null +++ b/layouts/observations/single.html @@ -0,0 +1,42 @@ +{{ define "main"}} +{{ .Scratch.Set "customTitleHeaderSet" true }} +{{ .Scratch.Set "customTitleHeader" "Observations" }} +{{ .Scratch.Set "customTitleHeaderLink" "/observations" }} +{{ partial "header.html" . }} +
+ {{ with .Params }} + +
+ {{ $name := "" }} + {{ if (ne .taxon.common_name "") }} + {{ $name = .taxon.common_name }} + {{ else }} + {{ $name = .taxon.name }} + {{ end }} + {{ $obsURL := .url }} +

{{ title $name }}

+ {{ if (eq .quality_grade "research")}} + Research Grade +
+ {{ end }} +

Observed on

+

Location: {{ .place_guess }}

+ Also on: iNaturalist + +
+ {{ if gt (len .photos) 0 }} + {{ range .photos}} + {{ $medium_url := replace .url "square" "medium"}} + {{ $original_url := replace .url "square" "original"}} + Photo of {{ .species_guess }} + {{ end }} + {{ end }} +
+ +
+ {{ end }} +
+ + +{{ partial "footer.html" . }} +{{ end }} diff --git a/layouts/partials/inat.html b/layouts/partials/inat.html new file mode 100644 index 0000000..f1adcce --- /dev/null +++ b/layouts/partials/inat.html @@ -0,0 +1,41 @@ +{{ $obsData := .Scratch.Get "obs" }} +{{ $scratchURL := .Scratch.Get "obs_url" }} + +{{ with $obsData }} + +
+ {{ $name := "" }} + {{ if (ne .taxon.common_name "") }} + {{ $name = .taxon.common_name }} + {{ else }} + {{ $name = .taxon.name }} + {{ end }} + {{ $obsURL := .url }} + {{ with $scratchURL }} + {{ $obsURL = . }} + {{ end }} +

{{ title $name }}

+ {{ if (eq .quality_grade "research")}} + Research Grade +
+ {{ end }} +

Observed on

+
+ +

Location: {{ .place_guess }}

+ + + {{ if gt (len .photos) 0 }} +
+ {{ range .photos}} + {{ $small_url := replace .url "square" "small"}} + {{ $original_url := replace .url "square" "original"}} + Photo of {{ .species_guess }} + {{ end }} +
+ {{ end }} +
+ + | Also on: iNaturalist +
+ {{ end }}