From 1b619dd8c0fbedcad8248f0504143e4d11c20968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Boe=CC=88s?= Date: Mon, 17 Oct 2016 09:25:48 +0200 Subject: [PATCH] AMP pages now have proper Youtube tags --- src/models/post.js | 6 +++++- themes/default/templates/amp-post.html | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/models/post.js b/src/models/post.js index 40ea56b8..084910c0 100644 --- a/src/models/post.js +++ b/src/models/post.js @@ -232,10 +232,14 @@ var Post = function (filename, markdown, meta) { * @return {String} [description] */ external.ampifyHtml = function(html) { + // + // return html .replace(/(<\/?)(img|video|audio|iframe)/g, '$1amp-$2') - .replace(/(]+)\/>/g,'$1>') + .replace(/(]+) allowfullscreen=".+?"/g, '$1') + .replace(/]*) src="https:\/\/www.youtube.com\/embed\/(.+?)\?enablejsapi=1"([^>]*)>(.*?)<\/amp-iframe>/g,'') .replace(/().+(<\/amp-(?:video|iframe))/g, '$1$2') ; diff --git a/themes/default/templates/amp-post.html b/themes/default/templates/amp-post.html index 461cb3ae..c709f32d 100644 --- a/themes/default/templates/amp-post.html +++ b/themes/default/templates/amp-post.html @@ -9,6 +9,7 @@ +