diff options
-rw-r--r-- | config/privacy/privacyConfig.go | 5 | ||||
-rw-r--r-- | config/privacy/privacyConfig_test.go | 1 | ||||
-rw-r--r-- | tpl/tplimpl/embedded/templates.autogen.go | 21 | ||||
-rwxr-xr-x | tpl/tplimpl/embedded/templates/shortcodes/youtube.html | 6 | ||||
-rw-r--r-- | tpl/tplimpl/embedded/templates/shortcodes/youtube_simple.html | 14 |
5 files changed, 3 insertions, 44 deletions
diff --git a/config/privacy/privacyConfig.go b/config/privacy/privacyConfig.go index 33e98754c..6dad54e72 100644 --- a/config/privacy/privacyConfig.go +++ b/config/privacy/privacyConfig.go @@ -89,11 +89,6 @@ type YouTube struct { // YouTube won’t store information about visitors on your website // unless the user plays the embedded video. PrivacyEnhanced bool - - // If simple mode is enabled, only a thumbnail is fetched from ytimg.com and - // shown with a play button overlaid. If a user clicks the button, he/she will - // be taken to the video page on youtube.com in a new browser tab. - Simple bool } func DecodeConfig(cfg config.Provider) (pc Config, err error) { diff --git a/config/privacy/privacyConfig_test.go b/config/privacy/privacyConfig_test.go index 112e45988..7e736ce96 100644 --- a/config/privacy/privacyConfig_test.go +++ b/config/privacy/privacyConfig_test.go @@ -70,7 +70,6 @@ simple = true assert.True(pc.YouTube.PrivacyEnhanced) assert.True(pc.YouTube.Disable) - assert.True(pc.YouTube.Simple) } func TestDecodeConfigFromTOMLCaseInsensitive(t *testing.T) { diff --git a/tpl/tplimpl/embedded/templates.autogen.go b/tpl/tplimpl/embedded/templates.autogen.go index 9637deb10..43e1b4d15 100644 --- a/tpl/tplimpl/embedded/templates.autogen.go +++ b/tpl/tplimpl/embedded/templates.autogen.go @@ -384,30 +384,13 @@ 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 {`shortcodes/youtube.html`, `{{- $pc := .Page.Site.Config.Privacy.YouTube -}} {{- if not $pc.Disable -}} {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} -{{- if $pc.Simple -}} -{{ template "_internal/shortcodes/youtube_simple.html" . }} -{{- else -}} {{- $id := .Get "id" | default (.Get 0) -}} {{- $class := .Get "class" | default (.Get 1) }} <div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}> <iframe src="//{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe> </div> -{{ end }} -{{- end -}}`}, - {`shortcodes/youtube_simple.html`, `{{ $id := .Get "id" | default (.Get 0) }} -{{ $class := .Get "class" | default (.Get 1) }} -{{ $hasClass := $class }} -{{ $class := $class | default "__h_youtube" }} -{{ if not $hasClass }} -{{/* If class is set, assume the user wants to provide his own styles. */}} -{{ template "__h_simple_css" $ }} -{{ end }} -{{ $secondClass := "s_youtube_simple" }} -<div class="{{ $secondClass }} {{ $class }}"> -{{ $tb := printf "//i.ytimg.com/vi/%s/" $id }} -<a href="//youtube.com/watch?v={{ $id | safeHTMLAttr }}" target="_blank"> - <img src="{{ printf "%smaxresdefault.jpg" $tb }}" srcset="{{ printf "%shqdefault.jpg" $tb }} 1x {{ printf "%smaxresdefault.jpg" $tb }} 2x" alt="Video"> -<div class="play"><svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="{{ template "__h_simple_icon_play" $ }}" fill="#212121" fill-opacity="0.8"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg></div></a></div>`}, +{{ end -}} +`}, {`twitter_cards.html`, `{{- with $.Params.images -}} <meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:image" content="{{ index . 0 | absURL }}"/> diff --git a/tpl/tplimpl/embedded/templates/shortcodes/youtube.html b/tpl/tplimpl/embedded/templates/shortcodes/youtube.html index bbb3fdd07..9ba38fa8c 100755 --- a/tpl/tplimpl/embedded/templates/shortcodes/youtube.html +++ b/tpl/tplimpl/embedded/templates/shortcodes/youtube.html @@ -1,13 +1,9 @@ {{- $pc := .Page.Site.Config.Privacy.YouTube -}} {{- if not $pc.Disable -}} {{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} -{{- if $pc.Simple -}} -{{ template "_internal/shortcodes/youtube_simple.html" . }} -{{- else -}} {{- $id := .Get "id" | default (.Get 0) -}} {{- $class := .Get "class" | default (.Get 1) }} <div {{ with $class }}class="{{ . }}"{{ else }}style="position: relative; padding-bottom: 56.25%; padding-top: 30px; height: 0; overflow: hidden;"{{ end }}> <iframe src="//{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" {{ if not $class }}style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;" {{ end }}allowfullscreen frameborder="0" title="YouTube Video"></iframe> </div> -{{ end }} -{{- end -}}
\ No newline at end of file +{{ end -}} diff --git a/tpl/tplimpl/embedded/templates/shortcodes/youtube_simple.html b/tpl/tplimpl/embedded/templates/shortcodes/youtube_simple.html deleted file mode 100644 index 641bd124b..000000000 --- a/tpl/tplimpl/embedded/templates/shortcodes/youtube_simple.html +++ /dev/null @@ -1,14 +0,0 @@ -{{ $id := .Get "id" | default (.Get 0) }} -{{ $class := .Get "class" | default (.Get 1) }} -{{ $hasClass := $class }} -{{ $class := $class | default "__h_youtube" }} -{{ if not $hasClass }} -{{/* If class is set, assume the user wants to provide his own styles. */}} -{{ template "__h_simple_css" $ }} -{{ end }} -{{ $secondClass := "s_youtube_simple" }} -<div class="{{ $secondClass }} {{ $class }}"> -{{ $tb := printf "//i.ytimg.com/vi/%s/" $id }} -<a href="//youtube.com/watch?v={{ $id | safeHTMLAttr }}" target="_blank"> - <img src="{{ printf "%smaxresdefault.jpg" $tb }}" srcset="{{ printf "%shqdefault.jpg" $tb }} 1x {{ printf "%smaxresdefault.jpg" $tb }} 2x" alt="Video"> -<div class="play"><svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="{{ template "__h_simple_icon_play" $ }}" fill="#212121" fill-opacity="0.8"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg></div></a></div>
\ No newline at end of file |