diff options
author | Alex <onedrawingperday@gmail.com> | 2018-05-30 23:42:32 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-05-31 18:05:38 +0200 |
commit | 07b96d16e8679c40e289c9076ef4414ed6eb7f81 (patch) | |
tree | a48b1b963450746af1657081ccedfab8c995b2b6 /tpl | |
parent | ceaff7cafc5357274e546984ae02a4cbdf305f81 (diff) |
Fixes #4798
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/tplimpl/embedded/templates.autogen.go | 37 | ||||
-rwxr-xr-x | tpl/tplimpl/embedded/templates/shortcodes/twitter.html | 4 | ||||
-rw-r--r-- | tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html | 33 |
3 files changed, 74 insertions, 0 deletions
diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index e9fcc3325..44a330622 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -390,10 +390,47 @@ if (!doNotTrack) { {{- end -}}`}, {`shortcodes/twitter.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}} {{- if not $pc.Disable -}} +{{- if $pc.Simple -}} +{{ template "_internal/shortcodes/twitter_simple.html" . }} +{{- else -}} {{- $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 -}} {{- end -}}`}, + {`shortcodes/twitter_simple.html`, `{{- $pc := .Page.Site.Config.Privacy.Twitter -}} +{{- $sc := .Page.Site.Config.Services.Twitter -}} +{{- if not $pc.Disable -}} +{{- $id := .Get 0 -}} +{{- $json := getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" $id "&omit_script=true" -}} +{{- if not $sc.DisableInlineCSS -}} +{{ template "__h_simple_twitter_css" $ }} +{{- end -}} +{{ $json.html | safeHTML }} +{{- end -}} + +{{ define "__h_simple_twitter_css" }} +{{ if not (.Page.Scratch.Get "__h_simple_twitter_css") }} +{{/* Only include once */}} +{{ .Page.Scratch.Set "__h_simple_twitter_css" true }} +<style type="text/css"> + .twitter-tweet { + font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; + border-left: 4px solid #2b7bb9; + padding-left: 1.5em; + color: #555; +} + .twitter-tweet a { + color: #2b7bb9; + text-decoration: none; +} + blockquote.twitter-tweet a:hover, + blockquote.twitter-tweet a:focus { + text-decoration: underline; +} +</style> +{{ end }} +{{ end }}`}, {`shortcodes/vimeo.html`, `{{- $pc := .Page.Site.Config.Privacy.Vimeo -}} {{- if not $pc.Disable -}} {{- if $pc.Simple -}} diff --git a/tpl/tplimpl/embedded/templates/shortcodes/twitter.html b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html index 472bd8572..ea7f10c38 100755 --- a/tpl/tplimpl/embedded/templates/shortcodes/twitter.html +++ b/tpl/tplimpl/embedded/templates/shortcodes/twitter.html @@ -1,6 +1,10 @@ {{- $pc := .Page.Site.Config.Privacy.Twitter -}} {{- if not $pc.Disable -}} +{{- if $pc.Simple -}} +{{ template "_internal/shortcodes/twitter_simple.html" . }} +{{- else -}} {{- $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 -}} {{- end -}}
\ No newline at end of file diff --git a/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html b/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html new file mode 100644 index 000000000..45d594fd9 --- /dev/null +++ b/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html @@ -0,0 +1,33 @@ +{{- $pc := .Page.Site.Config.Privacy.Twitter -}} +{{- $sc := .Page.Site.Config.Services.Twitter -}} +{{- if not $pc.Disable -}} +{{- $id := .Get 0 -}} +{{- $json := getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" $id "&omit_script=true" -}} +{{- if not $sc.DisableInlineCSS -}} +{{ template "__h_simple_twitter_css" $ }} +{{- end -}} +{{ $json.html | safeHTML }} +{{- end -}} + +{{ define "__h_simple_twitter_css" }} +{{ if not (.Page.Scratch.Get "__h_simple_twitter_css") }} +{{/* Only include once */}} +{{ .Page.Scratch.Set "__h_simple_twitter_css" true }} +<style type="text/css"> + .twitter-tweet { + font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; + border-left: 4px solid #2b7bb9; + padding-left: 1.5em; + color: #555; +} + .twitter-tweet a { + color: #2b7bb9; + text-decoration: none; +} + blockquote.twitter-tweet a:hover, + blockquote.twitter-tweet a:focus { + text-decoration: underline; +} +</style> +{{ end }} +{{ end }}
\ No newline at end of file |