skip to Main Content

I have started integrating the AMP concept in my current Magento live project.

I have did below things.

one test html file in www folder as suggested here, https://www.ampproject.org/docs/get_started/create/basic_markup.html this worked great.

I have did in my magento project, in 1column.phtml,

<!DOCTYPE html>
<html amp lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">

in head.phtml, added first line as below

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />
<link rel="canonical" href="http://www.example.com" />
<script type="application/ld+json">
      {
        "@context": "http://schema.org",
        "@type": "NewsArticle",
        "headline": "Open-source framework for publishing content",
        "datePublished": "2015-10-07T12:02:41Z",
        "image": [
          "logo.jpg"
        ]
      }
    </script>
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
    <script async src="https://cdn.ampproject.org/v0.js"></script>

I am running home page by appending #development=1. and getting the error in console as below:

TypeError: aa.Object.getOwnPropertyDescriptor(...) is not a non-null object
(var e in b)aa.Object.defineProperties?aa.Object.defineProperty(a,e,aa.Object.ge...
  validator.js (line 2, col 221)

ReferenceError: amp is not defined

Can anyone help me to fix this issue.

Thanks in advance..

2

Answers


  1. Try to remove

    xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>"
    

    first 2 lines should be like this

    <!doctype html>
    <html amp lang="en">
    
    Login or Signup to reply.
  2. What might be more simple is using an extension to integrate AMP into your Magento store. I’ve used the one described created by coding basics: http://codingbasics.net/accelerated-mobile-pages-magento/

    Really simple to set it up, and it works flawlessly. Don’t know if you’ve already fixed this issue as some time has passed but I thought I’d reply anyway to help you and others out.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search