summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/tweet-ref.html
blob: cf02c4c954f7de892b77732fb06dfb89117824c1 (plain)
1
2
3
4
5
6
7
8
9
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>