我想保持我的 JSON-LD 脚本的内容是动态的。但是,AMP 不允许我使用 Javascript,脚本应该在头脑中。
由于 amp-list,保持正文内容动态不是问题。
<head>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "www.google.com"
},
"headline": "???"
}
</script>
</head>
<body>
<amp-list layout="fixed-height" height="100vh" width="auto" src="www.google.com/json" class="m1">
<template type="amp-mustache" id="amp-template-id">
<p>{{title}}</p>
</template>
</amp-list>
</body>
可以使用 {{}} 在 amp-list 标记中访问文章的标题。我需要头部的 json-ld 中的这个值作为标题的值。关于如何做到这一点的任何建议?