summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-24 12:25:52 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-05-24 12:25:52 +0200
commit9753cb59f1f1d866943a485dd7c917d1b68f6eda (patch)
tree99d98e265f94011689d0589b76ac49d6256edc16 /tpl
parent3bfe8f4be653f44674293685cb5750d90668b2f6 (diff)
Support DNT in Twitter shortcode for GDPR
Fixes #4765
Diffstat (limited to 'tpl')
-rw-r--r--tpl/tplimpl/embedded/templates.autogen.go4
-rwxr-xr-xtpl/tplimpl/embedded/templates/shortcodes/twitter.html4
2 files changed, 6 insertions, 2 deletions
diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go
index 94e4c33ab..a64ff83bf 100644
--- a/tpl/tplimpl/embedded/templates.autogen.go
+++ b/tpl/tplimpl/embedded/templates.autogen.go
@@ -365,7 +365,9 @@ M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.5
{{- end -}}`},
{`shortcodes/twitter.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}}
{{- if not $pc.Disable -}}
-{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" (index .Params 0)).html | safeHTML }}
+{{ $url := printf "https://api.twitter.com/1/statuses/oembed.json?id=%s&dnt=%t" (index .Params 0) $pc.EnableDNT }}
+{{ $json := getJSON $url }}
+{{ $json.html | safeHTML }}
{{- end -}}`},
{`shortcodes/vimeo.html`, `{{- $pc := .Page.Site.Config.Privacy.Vimeo -}}
{{- if not $pc.Disable -}}
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/twitter.html b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
index d9bef725f..62dd21592 100755
--- a/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html
@@ -1,4 +1,6 @@
{{- $pc := .Page.Site.Config.Privacy.Twitter -}}
{{- if not $pc.Disable -}}
-{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" (index .Params 0)).html | safeHTML }}
+{{ $url := printf "https://api.twitter.com/1/statuses/oembed.json?id=%s&dnt=%t" (index .Params 0) $pc.EnableDNT }}
+{{ $json := getJSON $url }}
+{{ $json.html | safeHTML }}
{{- end -}} \ No newline at end of file