-1

*I have made a static HTML page using the AMP boilerplate which contains details of a fruit product say apple, so my URL looks like www.xyz.com/apple

The page contains a simple <amp-carousel> and some data with src relevant to apple.(product in route) Which contains the title 'Apple', 3 images inside <amp-img> of <amp-carousel>, and an <amp-list> with src depending upon URL route/path.

Lets say I have other products whose details I want to show by changing route path to www.xyz.com/orange, www.xyz.com/pears, www.xyz.com/grapes etc.

SupposeI want to keep it dynamic depending upon the URL, say for www.xyz.com/orange, my static page would now contain similar information, but relevant to URL path - ie. orange/pears/grapes

As the different product contains the different title, different number of images for amp-list, amp-carousel or any simple list, how can I make my content dynamic for updated path in URL using ReactJS/ES6 syntax.

Also, provide any information about data flow/lifecycle methods for AMP pages before HTML is made on the server(which I assume I am missing).

Andrew
  • 1,203
  • 9
  • 13

1 Answers1

0

First off, you can't use ReactJS or ES6 in an AMP page as stated in the AMP spec here.

What you're trying to do will require a fairly basic set up on the backend that'll take the path to determine what data to use to build an AMP page.

Andrew
  • 1,203
  • 9
  • 13