amp-html

amp-list with dynamic height

天大地大妈咪最大 提交于 2019-12-04 13:35:30
问题 I'm using amp-list and I would like to have a dynamic height based on the results that I got. There is a way to do it? I couldn't get it done. <amp-list src="request-url"> <template type="amp-mustache" id="amp-template-id"> ... </template> </amp-list> All the available layouts requires dimensions at the amp-list level or parent level. However I don't want to specify an height. My results can either have 1 or 12 items. 回答1: There is no dynamic layout in AMP (this is to avoid reflow while the

How to fix: Referenced AMP URL is not an AMP

只愿长相守 提交于 2019-12-04 13:05:02
Search console added a bunch of issues with "Referenced AMP URL is not an AMP". If I use the AMP Test I get: However, when I check in https://validator.ampproject.org/ it shows: Here is a list of some of the URLs that the Search Console says are not valid AMP pages: https://www.beek.io/amp/frases/satan-una-autobiografia https://www.beek.io/amp/frases/mi-isla https://www.beek.io/amp/frases/magnus-chase-y-los-dioses-de-asgard-1-la-espada-del-tiempo I don't understand what Google expect me to fix. Going to add an answer here as well... you could try something similar to what is described on this

AMP: Origin of <amp-iframe> must not be equal to container

非 Y 不嫁゛ 提交于 2019-12-04 10:12:01
I want to solve this problem in my first AMP project, This is the problem that I have: error.js:58: Origin of <amp-iframe> must not be equal to container This is my amp-iframe code in my index.html: <amp-iframe width=100 height=100 layout="nodisplay" sandbox="allow-same-origin allow-forms allow-scripts" src="https://www.example.com/scripts/app.js"> </amp-iframe> when I navigate the console tab, this is what I have: Powered by AMP ⚡ HTML – Version 1462999126709 AMP validation successful. I used <amp-iframe> to use external javascript, my custom.js The problem is that you're trying to amp-iframe

AMP image is not appearing

▼魔方 西西 提交于 2019-12-04 09:41:30
I can't get this amp-img to show up. It works as an image, and when I click the src-link it loads on a separate page correctly. Changing it to amp-img makes it disappear. I set background-color: red on the amp-img and the box appears correctly, but it's an empty red box. HTML: <li> <a href="/"> <amp-img src="https://d12v9rtnomnebu.cloudfront.net/oursite/logo_white.png" alt="site logo" width="264" height="96"/> </a> </li> CSS (probably a lot of extraneous stuff that needs to be trimmed but don't know what's important until it works): .amp .site-menu li { height: 32px; line-height: 32px; } .amp

Is it possible to make images responsive in AMP HTML or I need to declare the image size for each screen resolution in my media queries?

ε祈祈猫儿з 提交于 2019-12-04 04:38:26
问题 Most images on my website occupy the whole screen width, so in my current website version (not AMP) I set all the images in my CSS to fill the whole screen width by doing this: body img { width:100% } Is there anything equivalent to this in AMP? 回答1: If you specify layout="responsive" as an attribute of the <amp-img> tag then the image will behave roughly like you've described. See an example at http://www.mirror.co.uk/news/uk-news/bonfire-night-2015-how-keep-6767214.amp The <amp-img> tag

How can I implement AMP in angular/ionic website?

此生再无相见时 提交于 2019-12-04 03:32:26
Recently i've heard about the Accelerated Mobile Pages project, and read some info about it. I wonder how to implement it for existing website that is built upon Ionic and Angular? Basically there is no nearly possible solution to do that. If you check the doc here . Keep all third-party JavaScript out of the critical path Third-party JS likes to use synchronous JS loading. They also like to document.write more sync scripts. For example, If you five ads, and each does three sync loads, with a 1 second latency connection, you’re in 18 seconds of load time just for JS loading. AMP pages allow

Embed Map with Marker on AMP HTML page

眉间皱痕 提交于 2019-12-04 02:48:42
Currently I use the Google Maps API to generate a map with a marker (given a lat/long set of coordinates) to a given location. In AMP HTML, it appears the way to do this currently is using the amp-iframe extension https://github.com/ampproject/amphtml/tree/master/extensions . The issue is you cannot use Google Maps embed code with coordinates unless you are using a 'view' map. I don't have a Place ID, so I cannot use the Place mode. I can't use 'View' mode, since that has no markers. I've looked high and low at https://developers.google.com/maps/documentation/embed/guide#overview What is the

AMP browser support?

非 Y 不嫁゛ 提交于 2019-12-03 22:16:39
Looking at the AMP spec, given the reliance on CSS variables to custom style elements, this means current browser support is narrow. See: Can I use reference I'm guessing there is a 'graceful fallback' to non custom styled, since browsers not understanding the CSS variables will just ignore that CSS. Is there a browser compatibility/support matrix for AMP? Browser Support In general we support the 2 latest versions of major browsers like Chrome, Firefox, Edge, Safari and Opera. We support desktop, phone, tablet and the web view version of these respective browsers. Beyond that the core AMP

Access cookies through an API on AMP page

故事扮演 提交于 2019-12-03 14:05:05
问题 I am converting a page to google AMP and need to access cookies to set a view of a division. I am thinking of creating an API for this. The API will just return all the cookies available on my domain in JSON format. I will hit the API using <amp-state> component and store the returned JSON. Then will take actions according to this state. Is this a valid approach to use in AMP? Is there any security flow in this? 回答1: Using amp-list is the right approach in this case. amp-list makes a request

Google AMP - displaying AMP-enabled pages only when accessed via Google search results

血红的双手。 提交于 2019-12-02 11:48:33
问题 I have been asked to set up Google Accelerated Mobile Pages (AMP) for our news websites, so that pages will load faster on mobile devices. I've just started on this and I have a question to which I can't seem to find the answer in the official documentation. Is the AMP version of a webpage only intended to be displayed when it is accessed via the Google Search results page? So, if a site visitor is accessing a news article on their mobile browser but they entered the site address directly