【发布时间】:2017-08-11 12:32:54
【问题描述】:
我想保持我的 JSON-LD 脚本的内容是动态的。但是,AMP 不允许我使用 Javascript,脚本应该在头部。
由于 amp-list,保持 body 的内容动态不是问题。
<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 中的这个值作为标题的值。有关如何执行此操作的任何建议?
【问题讨论】:
标签: html json json-ld accelerated-mobile-page