diff options
| author | Reorx <novoreorx@gmail.com> | 2022-09-06 01:43:08 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-09-06 01:43:08 +0800 |
| commit | 8d679ad58d6930eb9dfe2be5c03086af0a0dd992 (patch) | |
| tree | c0d7bcc8e30493b0633aafaa031051e1d6068fa4 /layouts/shortcodes | |
| parent | a316c983a6e3118a5278b0522381217f31c7b47c (diff) | |
add shortcode tweet-ref for creating tweet reference in footnotes
Diffstat (limited to 'layouts/shortcodes')
| -rw-r--r-- | layouts/shortcodes/tweet-ref.html | 10 |
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> |
