summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/social_quote_tweet.html2
-rw-r--r--layouts/shortcodes/tweet-ref.html10
2 files changed, 11 insertions, 1 deletions
diff --git a/layouts/partials/social_quote_tweet.html b/layouts/partials/social_quote_tweet.html
index b3068aa..d0bd66d 100644
--- a/layouts/partials/social_quote_tweet.html
+++ b/layouts/partials/social_quote_tweet.html
@@ -4,7 +4,7 @@
{{ with .title }}<span>{{ . }}</span>{{ end }}
</div>
- {{ $dnt := true }}
+ {{- $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 -}}
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>