Displaying the amplifier document on the shell page

I am trying to make the amp doc look like https://codelabs.developers.google.com/codelabs/amp-in-pwa/#6

When i do

fetchDocument(url).then(function(doc) {
        // Let AMP take over and render the page
        var ampedDoc = AMP.attachShadowDoc(container, doc, url);
        ampedDoc.close();

    });

      

amp doc (retrieved from url) is put into container, but amp tags are not displayed.

For example: the tag amp-img

is in sources, but it does not appear as an img tag in the "Googe Search" search engine when it displays this document.

Question . Is there a way to render amp components when loading amp documents usinghttps://cdn.ampproject.org/shadow-v0.js

+3


source to share


1 answer


AMP components like amp-img should be rendered inside the application shell. Without a code snippet, it's hard to tell what will go wrong in your case. Here are two things you can do to find the problem:



  • Check your javascript console for error messages.
  • Checkout and run a sample lab code and see if it works :. If so, compare it to your own implementation.
0


source







All Articles