【发布时间】:2021-12-02 21:15:06
【问题描述】:
在结构化数据标记中,我想用 java 脚本插入发布日期。有没有办法做到这一点?
示例架构;
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": "Article headline",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
],
"datePublished": "+ date variable +",
"author": [{
"@type": "Person",
"name": "Jane Doe",
"url": "http://example.com/profile/janedoe123"
},{
"@type": "Person",
"name": "John Doe",
"url": "http://example.com/profile/johndoe123"
}]
}
</script>
我必须在页面上的时间标签中获取日期并使用 javascript 将其放入架构中。
<time datetime="2021-02-24T12:11:00+03:00">2021-02-24T12:11:00+03:00</time>
【问题讨论】:
-
为什么不用
<data:post.date/>而不是+ date variable + -
我正在将它添加到帖子内容中,数据代码在这里不起作用。
标签: javascript schema blogger json-ld