0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Fixed missing amp-youtube properties (#15880)

fixes: https://github.com/TryGhost/Ghost/issues/15878

- Fix `amp-youtube` component, add mandatory `width` and `height`
properties. Also change the `layout` property to `responsive`, so that
the width adapts to mobile devices.

---

Error log:
`The mandatory attribute 'height' is missing in tag 'amp-youtube'.`

Documentation `amp-youtube`:
https://amp.dev/documentation/components/amp-youtube
This commit is contained in:
Gabriel Ribeiro 2022-11-25 04:26:33 -03:00 committed by GitHub
parent 68d3faf77c
commit 64329d716e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,7 +108,7 @@ allowedAMPAttributes = {
'amp-audio': ['src', 'width', 'height', 'autoplay', 'loop', 'muted', 'controls'],
'amp-iframe': ['src', 'srcdoc', 'width', 'height', 'layout', 'frameborder', 'allowfullscreen', 'allowtransparency',
'sandbox', 'referrerpolicy'],
'amp-youtube': ['src', 'layout', 'frameborder', 'autoplay', 'loop', 'data-videoid', 'data-live-channelid']
'amp-youtube': ['src', 'layout', 'frameborder', 'autoplay', 'loop', 'data-videoid', 'data-live-channelid', 'width', 'height']
};
function getAmperizeHTML(html, post) {
@ -193,6 +193,10 @@ module.exports = async function amp_content() { // eslint-disable-line camelcase
$('audio').children('source').remove();
$('audio').children('track').remove();
$('amp-youtube').attr('layout', 'responsive');
$('amp-youtube').attr('height', '350');
$('amp-youtube').attr('width', '600');
ampHTML = $.html();
// @TODO: remove this, when Amperize supports HTML sanitizing