哪些 AMP 扩展程序可以从端点获取响应?

Which AMP extensions can fetch a response from an endpoint?

什么AMP extensions can be used to get a response from the server in the form of variable that can be used later, such as in a template or as a parameter to an attribute

它的名字并没有真正暗示它,但我想你想要 AMP-list

https://github.com/ampproject/amphtml/blob/master/extensions/amp-list/amp-list.md

Fetches content dynamically from a CORS JSON endpoint and renders it using a supplied template.

放大器访问

authorization endpoint of amp-access can return "a free-form JSON object":

Here’s a small list of possible ideas for properties that can be returned from the Authorization endpoint:

  • Metering info: maximum allowed number of views and current number of views.
  • Whether the Reader is logged in or a subscriber.
  • A more detailed type of the subscription: basic, premium
  • Geo: country, region, custom publication region

放大器形式

amp-form "allows publishers to render the responses using Extended Templates". The response is expected to be a valid JSON Object. Try the "Hiding input fields after success" demo in the amp-form sample 观看实际效果。

放大器列表

amp-list 获取 "content dynamically from a CORS JSON endpoint and renders it using a supplied template"。响应必须是包含数组 属性 "items".

的 JSON 对象

除了 Mustache 模板中的 {{variable}} 替换之外,您还可以在其他地方使用 AUTHDATA(variable)

amp-live-list(不完全)

amp-live-list is a "wrapper and minimal UI for content that updates live in the client instance as new content is available in the source document". The page will re-fetch itself, giving the server a change to send new content. If new content is found, AMP will populate a <div items> element with the new (HTML) items。您不能将其用作变量。