mirror of
https://github.com/Brandon-Rozek/website-theme.git
synced 2024-11-21 15:56:29 -05:00
Added theme for inaturalist observation showcase
This commit is contained in:
parent
31cbccf845
commit
8982737cbc
3 changed files with 107 additions and 0 deletions
24
layouts/observations/list.html
Normal file
24
layouts/observations/list.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{{ define "main"}}
|
||||
{{ partial "header.html" . }}
|
||||
<main>
|
||||
<style>main { text-align: left; }</style>
|
||||
{{ .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 }}
|
||||
</main>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
42
layouts/observations/single.html
Normal file
42
layouts/observations/single.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{{ define "main"}}
|
||||
{{ .Scratch.Set "customTitleHeaderSet" true }}
|
||||
{{ .Scratch.Set "customTitleHeader" "Observations" }}
|
||||
{{ .Scratch.Set "customTitleHeaderLink" "/observations" }}
|
||||
{{ partial "header.html" . }}
|
||||
<main>
|
||||
{{ with .Params }}
|
||||
|
||||
<article class="h-entry">
|
||||
{{ $name := "" }}
|
||||
{{ if (ne .taxon.common_name "") }}
|
||||
{{ $name = .taxon.common_name }}
|
||||
{{ else }}
|
||||
{{ $name = .taxon.name }}
|
||||
{{ end }}
|
||||
{{ $obsURL := .url }}
|
||||
<h1 class='title p-name'>{{ title $name }}</h1>
|
||||
{{ if (eq .quality_grade "research")}}
|
||||
<span>Research Grade </span><i class="fa fa-solid fa-clipboard-check"></i></i>
|
||||
<br/>
|
||||
{{ end }}
|
||||
<p class="date">Observed on <time class="dt-published" datetime='{{ .date }}'>{{ dateFormat "January 2, 2006 15:04" (time .date) }}</time></p>
|
||||
<p>Location: {{ .place_guess }}</p>
|
||||
<span>Also on: <a class="u-syndication" href="{{ .url }}">iNaturalist</a></span>
|
||||
|
||||
<div class="e-content">
|
||||
{{ if gt (len .photos) 0 }}
|
||||
{{ range .photos}}
|
||||
{{ $medium_url := replace .url "square" "medium"}}
|
||||
{{ $original_url := replace .url "square" "original"}}
|
||||
<a href="{{ $original_url }}"><img src="{{ $medium_url }}" alt="Photo of {{ .species_guess }}"/></a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
<a class="u-url" style="display: none">{{ .Permalink }}</a>
|
||||
</article>
|
||||
{{ end }}
|
||||
</main>
|
||||
|
||||
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
41
layouts/partials/inat.html
Normal file
41
layouts/partials/inat.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{{ $obsData := .Scratch.Get "obs" }}
|
||||
{{ $scratchURL := .Scratch.Get "obs_url" }}
|
||||
|
||||
{{ with $obsData }}
|
||||
|
||||
<article class="toot h-entry">
|
||||
{{ $name := "" }}
|
||||
{{ if (ne .taxon.common_name "") }}
|
||||
{{ $name = .taxon.common_name }}
|
||||
{{ else }}
|
||||
{{ $name = .taxon.name }}
|
||||
{{ end }}
|
||||
{{ $obsURL := .url }}
|
||||
{{ with $scratchURL }}
|
||||
{{ $obsURL = . }}
|
||||
{{ end }}
|
||||
<a href="{{ $obsURL }}"><h2 class="p-name">{{ title $name }}</h2></a>
|
||||
{{ if (eq .quality_grade "research")}}
|
||||
<span>Research Grade </span><i class="fa fa-solid fa-clipboard-check"></i></i>
|
||||
<br/>
|
||||
{{ end }}
|
||||
<p class="date">Observed on <time class="dt-published" datetime='{{ .created_at }}'>{{ dateFormat "January 2, 2006 15:04" (time .created_at) }}</time></p>
|
||||
<div class="e-content">
|
||||
|
||||
<p>Location: {{ .place_guess }}</p>
|
||||
|
||||
|
||||
{{ if gt (len .photos) 0 }}
|
||||
<div class="toot-photos">
|
||||
{{ range .photos}}
|
||||
{{ $small_url := replace .url "square" "small"}}
|
||||
{{ $original_url := replace .url "square" "original"}}
|
||||
<a href="{{ $original_url }}"><img src="{{ $small_url }}" alt="Photo of {{ .species_guess }}"/></a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
<a class="u-url" style="display: none">{{ .Permalink }}</a>
|
||||
<span>| Also on: <a class="u-syndication" href="{{ .url }}">iNaturalist</a></span>
|
||||
</article>
|
||||
{{ end }}
|
Loading…
Reference in a new issue