diff options
| author | Reorx <novoreorx@gmail.com> | 2022-05-18 13:46:15 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-05-18 13:46:15 +0800 |
| commit | 7c253d3fee18ff79c1fd446126bc577cb2658456 (patch) | |
| tree | 50cf8d3263f63c7cc984bb0798c603afe47546e5 /layouts/shortcodes | |
| parent | 570601c2a7a89893ad7bb8eb1f740dff260b2b3d (diff) | |
new shortcode: social-quote-tweet; enhance h2, h3 margin
Diffstat (limited to 'layouts/shortcodes')
| -rw-r--r-- | layouts/shortcodes/social-quote-tweet.html | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/layouts/shortcodes/social-quote-tweet.html b/layouts/shortcodes/social-quote-tweet.html new file mode 100644 index 0000000..d8b21ca --- /dev/null +++ b/layouts/shortcodes/social-quote-tweet.html @@ -0,0 +1,16 @@ +<div class="tweet social-quote"> + <div class="title"> + {{ safeHTML (index $.Site.Data.svg "twitter-simple") }} + {{ with .Inner }}<span>{{ . }}</span>{{ end }} + </div> + {{ $user := .Get "user" }} + {{ $id := .Get "id" }} + {{ $dnt := true }} + {{- .Inner -}}{{/* not required, only to not break Obsidian highlight by adding `/` before `>` */}} + + {{- $url := printf "https://twitter.com/%v/status/%v" $user $id -}} + {{- $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> |
