// Twitter holds the privacy configuration settingsrelated to the Twitter shortcode.
type Twitter struct {
Service `mapstructure:",squash"`
+
+ // When set to true, the Tweet and its embedded page on your site are not used
+ // for purposes that include personalized suggestions and personalized ads.
+ EnableDNT bool
}
// Vimeo holds the privacy configuration settingsrelated to the Vimeo shortcode.
disable = true
[privacy.twitter]
disable = true
+enableDNT = true
[privacy.vimeo]
disable = true
[privacy.youtube]
assert.True(pc.Instagram.Simple)
assert.True(pc.SpeakerDeck.Disable)
assert.True(pc.Twitter.Disable)
+ assert.True(pc.Twitter.EnableDNT)
assert.True(pc.Vimeo.Disable)
assert.True(pc.YouTube.PrivacyEnhanced)
{{- 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 -}}
{{- $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