特定の ContentType からすべてのコンテンツをループアウトすることができました。エントリの後に特定のアセットが続かないことを除いて、すべてがうまく機能します。
この特定のケースでは、次のようにレンダリングされます。 エントリ 1 エントリ 2 エントリ 3 アセット 1 アセット 2 アセット 3
次のようにレンダリングしたい: Entry 1 Asset 1、Entry 2 Asset 2 など...
フィールドループ内にアセット配列ループを配置しても役に立ちませんでした:)
Javascript
client.getEntries({
include: 1,
'content_type': 'posts'
})
.then((response) => {
var template = $('#myEntries').html();
var html = Mustache.to_html(template, response.toPlainObject());
$('.result').html(html);
})
.catch((error) => {
console.log('Error occured')
console.log(error)
})
HTML
<script id="myEntries" type="text/template">
{{#items}}
<h1>{{fields.header}}</h1>
<p>{{fields.description}}</p>
{{/items}}
{{#includes.Asset}}
<p>File: <img src="https:{{fields.file.url}}?fit=thumb&f=top_left&h=200&w=200" width="100"/></p>
{{/includes.Asset}}
</script>
<div class="result"></div>
JSON https://jsfiddle.net/pcgn73zf/
あなたの助けをいただければ幸いです!