summaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/tweet-ref.html10
1 files changed, 10 insertions, 0 deletions
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 @@
+<div class="tweet-ref">
+ {{- $url := .Get 0 -}}
+ From <a href="{{ $url }}">{{ strings.TrimPrefix "https://" $url }}</a>:
+
+ {{- $dnt := true -}}
+ {{- $query := querify "url" $url "dnt" $dnt -}}
+ {{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}}
+ {{- $json := getJSON $request -}}
+ {{- replaceRE "<script.+/script>" "" $json.html | safeHTML -}}
+</div>