amp-html

Does AMP HTML allow unofficial custom elements

放肆的年华 提交于 2019-12-08 22:00:15
问题 Will an AMP page work with an unofficial custom component? I can imagine getting an official one is best for spreading usage but for just 1 site which wants to program in some custom component does it need to get its component approved as official or it can just make one and include it in its own code? https://github.com/ampproject/amphtml/blob/master/spec/amp-html-components.md 回答1: No. An unofficial custom component would have to break the "AMP-conforming content may not have any JavaScript

amp image getting stretched, for responsive layout

点点圈 提交于 2019-12-08 10:03:36
问题 I am trying to contain an image in a wrapper, maintaining its aspect ratio. However the image stretches out. Below is a sample amp html, where I am facing the issue. <style> .image-wrapper { width: 150px; height: 150px; background: teal; } .image-wrapper img { height: auto; width: auto; max-width: 150px; max-height: 150px; } </style> <div class="image-wrapper"> <amp-img src="http://fyogi.com/public/images/products/mobiles/lg-google-nexus-5x-mqqci.c1.w150.jpg" layout="responsive" width="150"

How to Use AMP in Asp.net MVC

守給你的承諾、 提交于 2019-12-08 09:36:44
问题 I want to use Accelerated Mobile Page in MVC project I am working in asp.net MVC project in that I have two file one for mobile and one for desktop . so can I use AMP for mobile? anything problem arise if I can use combine? or I have to create new project for mobile? 回答1: It might be a good idea to read the AMP Project website. However we have ASP.NET WebForms and we have dynamically created AMP versions of our content by stripping out the HTML and converting the content to support AMP tags.

How to add custom javascript or external js in AMP page?

一个人想着一个人 提交于 2019-12-08 06:24:21
问题 I have tried adding external js file in AMP page but AMP validator rejects it. Is there any workaround for it? 回答1: AMP is a way to build fast rendering web page. In order to achieve this, AMP does not support external js. AMP have its own AMP JS library for more information CLICK HERE 回答2: Actully now you have option to add custom javascript to a AMP page with <amp-script> component. https://amp.dev/documentation/guides-and-tutorials/develop/custom-javascript/ 回答3: There is a workaround

Google AMP Purge CDN, When the Source Updated

我是研究僧i 提交于 2019-12-07 21:47:09
问题 Can we do anything to update the AMP CDN to purge specific pages or entire domain cached HTML? 回答1: You can update the contents of the cache on a URL by URL basis using the update ping mechanism: https://developers.google.com/amp/cache/update-ping This involves making a GET request to the AMP cache URL for your content. 回答2: I tied in the update-ping api call to our CMS when we publish or unpublish a story. So everytime we update or remove a page we call the update-ping API so we can update

Pass dynamic event label in Google AMP analytics event tracking

安稳与你 提交于 2019-12-07 20:42:56
问题 I want to track an event with google analytics when a link is clicked on my AMP html page. Also I want to pass the link(href) as eventLabel while tracking this event. Is there a way to set the link URL as data-* attribute which then can be passed to google analytics event tracking script. Or is there any other way to do this. This is pretty standard thing but Google Analytics for AMP page doesn't cover it. 回答1: I think what you are asking for was recently made available here. basically, you

Multiple Google Tracking Codes on AMP pages

拟墨画扇 提交于 2019-12-07 15:36:36
Is there a way to add different Google Analytics tracking accounts? I've been looking around but I only find examples and sites are using 1 single account: <script type="application/json"> { "requests": { "pageview": "https://example.com/analytics?url=${canonicalUrl}&title=${title}&acct=${account}", "event": "https://example.com/analytics?eid=${eventId}&elab=${eventLabel}&acct=${account}" }, "vars": { "account": "ABC123" }, "triggers": { "trackPageview": { "on": "visible", "request": "pageview" },... You can copy paste the amp-analytics tag twice. Or you can use use two triggers. Here are some

How to add custom javascript or external js in AMP page?

ぃ、小莉子 提交于 2019-12-07 02:54:30
I have tried adding external js file in AMP page but AMP validator rejects it. Is there any workaround for it? AMP is a way to build fast rendering web page. In order to achieve this, AMP does not support external js. AMP have its own AMP JS library for more information CLICK HERE Actully now you have option to add custom javascript to a AMP page with <amp-script> component. https://amp.dev/documentation/guides-and-tutorials/develop/custom-javascript/ There is a workaround using the amp-iframe component, but as mentioned in the previous answer, the whole idea of AMP is to build fast rendering

IFrame contents do not show up in an hidden div container

对着背影说爱祢 提交于 2019-12-06 16:03:01
I have got some problems while displaying an Iframe content within hidden DIV-Container. As soon as the link gets clicked, the div container gets visible, that works so far, but the content within, which is an amp-iframe itself do not show up. Something is preventing the Iframe from loading the content. Here is some code extract: <a href="#" class="bsel" [text]="visible ? 'On' : 'Off'" on="tap:AMP.setState({visible: !visible})"> Click me </a> ...... <div id="showInfo" [class]="visible ? 'show' : 'hide'" class="hide"> <amp-iframe width=600 height=500 scrolling=yes frameborder="1" layout=

AMP Project - Google Analytics - Content Grouping amp-analytics code

你离开我真会死。 提交于 2019-12-06 12:23:13
I am trying to assign content grouping variable to my Google Analytics code in my AMP markup. My AMP analytics code: <amp-analytics type="googleanalytics" id="analyticsgoogle1"> <script type="application/json"> { "vars": { "account": "UA-XXXXXXXX-X" }, "triggers": { "trackPageview": { "on": "visible", "request": "pageview" } } } </script> </amp-analytics> My regular Google analytics code: <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a