Search code snippets, questions, articles...

Add YouTube video on AMP page

To add or embed YouTube video on your AMP web page you need to add tag in your document body and amp-amp-youtube javascript library to your document tag.
<!--Add below code between body tag where you want to show youtube video-->
<amp-youtube
  data-videoid="DGQwd1_dpuc"
  layout="responsive"
  width="480"
  height="270">
  <div fallback>
    <p>Failed to load the video</p>
  </div>
</amp-youtube>

<!--Add this script to your head tag-->
<script async custom-element="amp-youtube" src="https://cdn.ampproject.org/v0/amp-youtube-0.1.js"></script>
Was this helpful?
0 Comments