github.com/neohugo/neohugo@v0.123.8/tpl/tplimpl/embedded/templates/shortcodes/twitter_simple.html (about) 1 {{- $pc := .Page.Site.Config.Privacy.Twitter -}} 2 {{- $sc := .Page.Site.Config.Services.Twitter -}} 3 {{- if not $pc.Disable -}} 4 {{- $id := or (.Get "id") "" -}} 5 {{- $user := or (.Get "user") "" -}} 6 {{- if and $id $user -}} 7 {{- template "render-simple-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "name" .Name "position" .Position) -}} 8 {{- else -}} 9 {{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}} 10 {{- end -}} 11 {{- end -}} 12 13 {{- define "render-simple-tweet" -}} 14 {{- $url := printf "https://twitter.com/%v/status/%v" .user .id -}} 15 {{- $query := querify "url" $url "dnt" .dnt "omit_script" true -}} 16 {{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}} 17 {{- with resources.GetRemote $request -}} 18 {{- with .Err -}} 19 {{- errorf "%s" . -}} 20 {{- else -}} 21 {{- (. | transform.Unmarshal).html | safeHTML -}} 22 {{- end -}} 23 {{- else -}} 24 {{- warnidf "shortcode-twitter-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" .name .position -}} 25 {{- end -}} 26 {{- end -}} 27 28 {{- define "__h_simple_twitter_css" -}} 29 {{- if not (.Page.Scratch.Get "__h_simple_twitter_css") -}} 30 {{/* Only include once */}} 31 {{- .Page.Scratch.Set "__h_simple_twitter_css" true -}} 32 <style type="text/css"> 33 .twitter-tweet { 34 font: 14px/1.45 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif; 35 border-left: 4px solid #2b7bb9; 36 padding-left: 1.5em; 37 color: #555; 38 } 39 .twitter-tweet a { 40 color: #2b7bb9; 41 text-decoration: none; 42 } 43 blockquote.twitter-tweet a:hover, 44 blockquote.twitter-tweet a:focus { 45 text-decoration: underline; 46 } 47 </style> 48 {{- end -}} 49 {{- end -}}