Can I use AMP (Accelerated Mobile Pages) components/tags on a page that is not a valid AMP page?

二次信任 提交于 2020-01-21 05:52:28

问题


Can I use AMP (Accelerated Mobile Pages) components/tags on a page that is not a valid AMP page?

Will I have advantages or disadvantages with this? Is it a good practice or not?

I would like to use the AMP components/tags by the way it load the elements (like amp-carousel and amp-img), but I can not fully convert my website to AMP since I have custom javascript codes that AMP page dont allow that I use (that do not apply using amp-iframe).

Is it better for me to keep standard elements and other libraries, or is it valid for me to use AMP components even though the page is not a valid AMP page?

Thanks!


回答1:


The major advantage of AMP is making the loading time better. You can achieve that by getting rid of Javascript, replacing img with amp-img etc. AMP offers plenty of it's own JS implementations for example for Twitter, Google Analytics, Pinterest and so on. See here: https://www.ampproject.org/docs/reference/components

Here you can find the information, that custom Javascript is restricted: https://www.ampproject.org/how-it-works/

If you don't want to resign from custom dynamic content, you can have two versions of you page and link them in <head>.

Disadvantages of having not fully AMP conform page? I think that Google might not index AMP pages that are not fully valid with AMP validation rules.




回答2:


I don't think this is going to work as one of the design principle of AMP is to Keep all third-party JavaScript out of the critical path, meaning no author-written Javascripts except those specified by AMP Pages. So it's either you have an AMP version of your website or a non-AMP (canonical) version.



来源:https://stackoverflow.com/questions/41270227/can-i-use-amp-accelerated-mobile-pages-components-tags-on-a-page-that-is-not-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!