Cleaning up layouts

This commit is contained in:
Brandon Rozek 2023-01-05 00:35:01 -05:00
parent 7b5e4f3aa4
commit 0247538cec
No known key found for this signature in database
GPG key ID: 26E457DA82C9F480
16 changed files with 8 additions and 76 deletions

View file

@ -0,0 +1,13 @@
{{ $gpxFile := .Scratch.Get "gpxFile" }}
{{ $url := printf "%sdata/tracks/%s" .Site.BaseURL $gpxFile }}
{{ $url_state := querify "state" (printf "{\"urls\":[\"%s\"]}" $url) }}
{{ $iframe_url := printf "https://gpx.studio/?%s&embed&distance" $url_state }}
{{ $a_url := printf "https://gpx.studio/?%s" $url_state }}
<iframe {{ printf "src=%q" $iframe_url | safeHTMLAttr }}
width="100%"
height="500"
frameborder="0"
allowfullscreen>
<p><a {{ printf "href=%q" $a_url | safeHTMLAttr }}></a></p>
</iframe>

41
layouts/partials/external/inat.html vendored Normal file
View 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 space-evenly">
{{ 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 }}

51
layouts/partials/external/toot.html vendored Normal file
View file

@ -0,0 +1,51 @@
{{ $tootData := .Scratch.Get "toot" }}
{{ with $tootData }}
{{ if ne .content "" }}
<article class="toot h-entry">
<div rel="author" class="h-card p-author toot-avatar">
<img class="u-photo" width=50 src="{{ .account.avatar }}"/>
<span style="display: none;">{{ .account.display_name }}</span>
</div>
<p class="date">Tooted on <time class="dt-published" datetime='{{ .created_at }}'>{{ dateFormat "January 2, 2006 15:04" (time .created_at) }}</time></p>
<div class="e-content p-name">
{{ .content | safeHTML }}
{{ if gt (len .media_attachments) 0 }}
<div class="toot-photos space-evenly">
{{ range .media_attachments}}
{{ if eq .type "image" }}
<img src="{{ .preview_url }}" alt="{{ .description }}"/>
{{ end }}
{{ end }}
</div>
{{ end }}
</div>
<a class="u-url" style="display: none">{{ .Permalink }}</a>
{{ range .tags }}
<a class="p-category" href="{{ .url }}" style="display: none;">{{ .name }}</a>
{{ end }}
<div class="toot-social">
{{ $post_url := urls.Parse .url }}
{{ $status_id := index (last 1 (split $post_url.Path "/")) 0 }}
{{ $social_url := printf "%s://%s/interact/%s" $post_url.Scheme $post_url.Host $status_id }}
{{ $reply_url := printf "%s?type=reply" $social_url }}
{{ $favorite_url := printf "%s?type=favourite" $social_url }}
{{ $boost_url := printf "%s?type=reblog" $social_url }}
<span>
<a class='fas fa-share' href="{{ $reply_url }}"></a>
{{ .replies_count }}
</span>
<span>
<a class='fas fa-retweet' href="{{ $boost_url }}"></a>
{{ .reblogs_count }}
</span>
<span>
<a class='fas fa-star' href="{{ $favorite_url }}"></a>
{{ .favourites_count }}
</span>
<span>| Source: <a class="u-syndication" href="{{ .url }}">{{ .url }}</a></span>
</div>
</article>
{{ end }}
{{ end }}

View file

@ -0,0 +1,31 @@
<!-- https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/twitter_cards.html -->
{{- with $.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
{{- $images := $.Resources.ByType "image" -}}
{{- $featured := $images.GetMatch "*feature*" -}}
{{- if not $featured }}{{ $featured = $images.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
{{- with $featured -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ $featured.Permalink }}"/>
{{- else -}}
{{- with $.Site.Params.images -}}
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="{{ index . 0 | absURL }}"/>
{{ else -}}
<meta name="twitter:card" content="summary"/>
<meta name="twitter:image" content="{{ .Site.BaseURL }}img/{{ .Site.Params.avatar }}"/>
{{- end -}}
{{- end -}}
{{- end }}
<meta name="twitter:title" content="{{ .Title }}"/>
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
{{ with .Site.Social.twitter -}}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end -}}
{{ range .Site.Authors }}
{{ with .twitter -}}
<meta name="twitter:creator" content="@{{ . }}"/>
{{ end -}}
{{ end -}}