From 8d679ad58d6930eb9dfe2be5c03086af0a0dd992 Mon Sep 17 00:00:00 2001 From: Reorx Date: Tue, 6 Sep 2022 01:43:08 +0800 Subject: add shortcode tweet-ref for creating tweet reference in footnotes --- layouts/shortcodes/tweet-ref.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 layouts/shortcodes/tweet-ref.html (limited to 'layouts/shortcodes') diff --git a/layouts/shortcodes/tweet-ref.html b/layouts/shortcodes/tweet-ref.html new file mode 100644 index 0000000..cf02c4c --- /dev/null +++ b/layouts/shortcodes/tweet-ref.html @@ -0,0 +1,10 @@ +
+ {{- $url := .Get 0 -}} + From {{ strings.TrimPrefix "https://" $url }}: + + {{- $dnt := true -}} + {{- $query := querify "url" $url "dnt" $dnt -}} + {{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}} + {{- $json := getJSON $request -}} + {{- replaceRE "" "" $json.html | safeHTML -}} +
-- cgit v1.2.3