aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/shortcodes
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-01-11 22:26:12 -0500
committertdro <tdro@noreply.example.com>2023-01-11 22:57:34 -0500
commitb2a8b775e04bf21ec110638efe70f57323cd3dd5 (patch)
treeec27cc632da89b94e1a644d25ee1a7668e1db23a /themes/default/layouts/shortcodes
parentfbf36e364b6442ca82eee39b5a86743dcab282ef (diff)
downloadcanory-b2a8b775e04bf21ec110638efe70f57323cd3dd5.tar.gz
canory-b2a8b775e04bf21ec110638efe70f57323cd3dd5.tar.bz2
canory-b2a8b775e04bf21ec110638efe70f57323cd3dd5.zip
themes/default/layouts/shortcodes/tweet: Replace with link
This embed has to be strangest I've ever looked at.. use a simple link card. Could use https://publish.twitter.com/oembed but that's annoying..
Diffstat (limited to 'themes/default/layouts/shortcodes')
-rw-r--r--themes/default/layouts/shortcodes/link.html28
-rw-r--r--themes/default/layouts/shortcodes/tweet.html18
2 files changed, 28 insertions, 18 deletions
diff --git a/themes/default/layouts/shortcodes/link.html b/themes/default/layouts/shortcodes/link.html
new file mode 100644
index 0000000..4b9b7a6
--- /dev/null
+++ b/themes/default/layouts/shortcodes/link.html
@@ -0,0 +1,28 @@
+{{- $source := default "https://example.com/" (.Get "source" | default (.Get 0)) -}}
+
+{{- $host := $source -}}
+
+{{- with (urls.Parse $source).Host -}}
+ {{- $host = . -}}
+{{- end -}}
+
+{{- $favicon := partial "function-favicon-domain.html" $host -}}
+
+{{- $image := partial "function-fetch-favicons.html"
+ (dict
+ "Source" $favicon
+ "Infix" ($host | anchorize)
+ )
+-}}
+
+<link-card>
+ <a href="{{ $source }}">
+ <img alt="{{ $host }}" src="{{ $image.Permalink }}" />
+ </a>
+ <article>
+ <h2>{{ $host }}</h2>
+ <a href="{{ $source }}">
+ {{ $source }}
+ </a>
+ </article>
+</link-card>
diff --git a/themes/default/layouts/shortcodes/tweet.html b/themes/default/layouts/shortcodes/tweet.html
deleted file mode 100644
index 759104b..0000000
--- a/themes/default/layouts/shortcodes/tweet.html
+++ /dev/null
@@ -1,18 +0,0 @@
-{{- $user := default "jack" (.Get "user" | default (.Get 0)) -}}
-{{- $status := default "20" (.Get "status" | default (.Get 1)) -}}
-{{- $caption := default "Twitter Tweet" (.Get "caption" | default (.Get 2)) -}}
-
-<twitter-tweet>
- <blockquote class="twitter-tweet">
- <a href="https://twitter.com/{{ $user }}/status/{{ $status }}">
- https://twitter.com/{{ $user }}/status/{{ $status }}
- </a>
- </blockquote>
- <script
- async
- src="https://platform.twitter.com/widgets.js"
- >
- </script>
-</twitter-tweet>
-
-<footer>{{ $caption }}</footer>