diff --git a/layouts/partials/social_links.html b/layouts/partials/social_links.html index 5eaee1c..e0f5415 100644 --- a/layouts/partials/social_links.html +++ b/layouts/partials/social_links.html @@ -1,20 +1,7 @@ - -{{- define "render-tweet" -}} - {{- $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 "" "" $json.html | safeHTML -}} -{{- end -}} diff --git a/layouts/partials/social_quote_tweet.html b/layouts/partials/social_quote_tweet.html new file mode 100644 index 0000000..b3068aa --- /dev/null +++ b/layouts/partials/social_quote_tweet.html @@ -0,0 +1,13 @@ +
+
+ {{ safeHTML (index site.Data.svg "twitter-simple") }} + {{ with .title }}{{ . }}{{ end }} +
+ + {{ $dnt := true }} + {{- $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 "" "" $json.html | safeHTML -}} +
diff --git a/layouts/shortcodes/social-quote-tweet.html b/layouts/shortcodes/social-quote-tweet.html index d8b21ca..205f0a9 100644 --- a/layouts/shortcodes/social-quote-tweet.html +++ b/layouts/shortcodes/social-quote-tweet.html @@ -1,16 +1 @@ -
-
- {{ safeHTML (index $.Site.Data.svg "twitter-simple") }} - {{ with .Inner }}{{ . }}{{ end }} -
- {{ $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 "" "" $json.html | safeHTML -}} -
+{{ partial "social_quote_tweet.html" (dict "user" (.Get "user") "id" (.Get "id") "title" .Inner) }}