Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we implement AMP in an angular app?

I am new to AMP and have been asked to add amp to an already developed angular website. I have also read that AMP Keep all third-party JavaScript out of the critical path But I am not sure whether it is possible or not.And if possible can you share some links for that. Any help is welcome

like image 864
Sim Avatar asked Oct 31 '16 04:10

Sim


2 Answers

Assuming you already have a site with Angular pages like:

  • 1.html
  • 2.html

Then you can create AMPs like:

  • 1.amp.html
  • 2.amp.html

1.html can use Angular and client-side javascript but 1.amp.html should be a representation of the same content but produced server-side rather than by using Angular javascript inside it. Follow the steps in here: https://ampbyexample.com/introduction/how_to_publish_amps/ and you should be fine.

like image 57
ade Avatar answered Sep 19 '22 19:09

ade


You can certainly link to AMP pages from your existing site, but the specification for AMP is a limited subset of HTML elements and there are restrictions on what JavaScript you can have running on your page. I don't believe you can have an AMP page powered by Angular.

like image 37
Toby Avatar answered Sep 17 '22 19:09

Toby