Skip to content

Link to YouTube rather than embedding.

Fixes problem where CSP forbids this type of embedding. Also adds some privacy because people wont get tracked by YouTube unless they click the link.

By wrapping an <img> tag with a video thumbnail in an <a class="youtube" href="https://youtube.com?v=..."> tag, the websites CSS will overlay a youtube play icon on top.

I liked the original idea of @licaon-kter to have _includes/youtubePlayer.html, except in order to pass a thumbnail to that, the site.baseurl is required. It is a little clunky to pass this information through to an include, so the next best thing is to allow the minimal amount of markup <a class="youtube"><img /></a> automatically get styled with a YouTube button over the top, without having to manually add it each time.

Merge request reports