@promohunt While I haven’t tested the same setup just yet have you tried the suggested solution from the below support topic?
https://ww.wp.xz.cn/support/topic/amp-and-youtube-lyte/
Hello James. In that topic, he did not show the video – but I have a video showing but does not show microdata.
Maybe there is some way to transfer the microdata for a videoobject from a regular page to amp via hook to functions.php?
@promohunt Can you share the example microdata output that you’re expecting? Please share the URL to the non-AMP page that has the microdata and the corresponding AMP page that lacks it.
Hello dear Weston. Many thanks
I’m interested in transferring to amp page VideoObject microdata
Non amp
https://clck.ru/NVwc5
Amp
https://clck.ru/NVwcT
For reference, the YouTube video with microdata added looks like this:
<div class="lyte-wrapper" title="ПИОНЫ отцвели - что делать? ОШИБКИ цветоводов" style="width:560px;max-width: 100%;margin:5px auto;">
<div class="lyMe" id="WYL_Sl-lpcCYv58" itemprop="video" itemscope itemtype="https://schema.org/VideoObject">
<div>
<meta itemprop="thumbnailUrl" content="http://vsaduidoma.com/wp-content/plugins/wp-youtube-lyte/lyteThumbs.php?origThumbUrl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSl-lpcCYv58%2Fhqdefault.jpg"/>
<meta itemprop="embedURL" content="https://www.youtube.com/embed/Sl-lpcCYv58"/>
<meta itemprop="uploadDate" content="2019-06-18T11:41:50.000Z"/>
</div>
<div id="lyte_Sl-lpcCYv58" data-src="http://vsaduidoma.com/wp-content/plugins/wp-youtube-lyte/lyteThumbs.php?origThumbUrl=https%3A%2F%2Fi.ytimg.com%2Fvi%2FSl-lpcCYv58%2Fhqdefault.jpg" class="pL">
<div class="tC">
<div class="tT" itemprop="name">ПИОНЫ отцвели - что делать? ОШИБКИ цветоводов</div>
</div>
<div class="play"></div>
<div class="ctrl">
<div class="Lctrl"></div>
<div class="Rctrl"></div>
</div>
</div>
<noscript>
<!--noindex--><a target="_blank" rel="nofollow" href="http://vsaduidoma.com/goto/http://youtu.be/Sl-lpcCYv58"><img alt="Ошибки при выращивании пионов" src="http://vsaduidoma.com/wp-content/plugins/wp-youtube-lyte/lyteThumbs.php?origThumbUrl=http%3A%2F%2Fi.ytimg.com%2Fvi%2FSl-lpcCYv58%2F0.jpg" alt="" width="560" height="295"/><br/>Watch
this video on YouTube</a><!--/noindex--></noscript>
<meta itemprop="description" content="Деление ПИОНОВ осенью: ПОШАГОВО: https://youtu.be/W2e7lXDJkGE 12 "ПОЧЕМУ" не цветут ПИОНЫ: https://youtu.be/rqxrGBbjSYc Совсем недавно мы с вами вспоминали наиболее частые причины отсутствия цветения у пионов. И учитывая то, что сам уход за этими цветами не представляет особых хлопот, все же, есть некоторые особенности агротехники, которые, я уверена, будут интересны начинающим цветоводам. Поэтому предлагаю сегодня поговорить о том, как ухаживать за пионами, чем подкармливать растения и когда и как нужно делать обрезку, чтобы они радовали своим цветением каждый год.">
</div>
</div>
From looking at the plugin code, it actually has some awareness of generating AMP pages. It is checking for is_amp_endpoint(). Namely, it is short-circuiting on AMP pages.
Therefore, I recommend opening an issue on the plugin’s support forum to request Microdata be added to AMP pages.
OK thanks for the recommendation. I already contacted the author of the plugin through FB. He has not yet decided on amp. Please tell me – how else can you add the markup of a videoobject to amp? Thanks again.
I’m not an expert on microdata for video, but the easiest way to inject markup into YouTube videos on AMP pages would be code like this:
add_filter(
'embed_oembed_html',
function ( $html, $url ) {
if (
function_exists( 'is_amp_endpoint' )
&&
is_amp_endpoint()
&&
in_array( wp_parse_url( $url, PHP_URL_HOST ), [ 'youtu.be', 'youtube.com' ], true )
) {
// @todo Modify $html to add the desired metadata.
}
return $html;
},
20,
2
);
Thank you very much – I will try and write the result