The amp-list component fetches dynamic content from a CORS JSON endpoint. The response from the endpoint contains data, which is rendered in the specified template.
Your endpoint must implement the requirements specified in the CORS Requests in AMP spec.
You can specify a template in one of two ways:
- a template attribute that references an ID of an existing templating element.
- a templating element nested directly inside the amp-list element.
When using in tandem with another templating AMP component, such as , note that templates may not nest in valid AMP documents. In this case a valid workaround is to provide the template by id via the template attribute. Learn more about nested templates in .
For more details on templates, see AMP HTML Templates.
Displaying a dynamic list
In the following example, we retrieve JSON data that contains URLs and titles, and render the content in a nested amp-mustache template.