4

我已经看到使用 src="example.com/json"的amp-list 。但是有没有办法在 amp-list 中使用博主 json 提要?

<amp-list width="auto" height="140" layout="fixed-height" 
src="https://example.blogspot.com/feeds/posts/default?alt=json">
<template type="amp-mustache">
-----
</template>
</amp-list>
4

2 回答 2

2

您应该能够使用以下模板配置呈现来自 Blogger 供稿的数据 -

<amp-list width="auto" height="140" layout="fixed-height" items="feed.entry" src="...?alt=json">
  <template type="amp-mustache">
    <div class="title">{{#title}}{{$t}}{{/title}}</div> <!-- Shows the title of the post -->
    <div class="content">{{#content}}{{{$t}}}{{/content}}</div> <!-- Shows santized content -->
  </template>
</amp-list>
于 2020-09-01T07:53:57.490 回答
2

是的,有一种方法可以在 amp 列表中使用博主 JSON;为此,您需要提及items='feed.entry'进入 JSON 的子部门,然后按照 mustache 模板指南获取必填字段。

于 2020-09-08T15:31:26.160 回答