尝试从网站上的模板动态提取HTML元素。 {{SCHEMA - Recipe Image}}
和{{SCHEMA - Recipe Description}}
无法正常工作。 {{SCHEMA - Recipe Image}}
引用了正确的部分,但在Google的结构化数据测试工具中返回null
(提供的值为image.url
必须是有效的网址)。
{{SCHEMA - Recipe Description}}
,当我创建文章架构,出于某种原因不能在这种类型的模式工作,这工作,使我在9号线一通过Google跟踪代码管理器插入JSON
错误,人物5:解析错误。 '}'预计
错误。
任何人都可以帮助我理解为什么图像URL和说明未被正确拉取?
<script>
(function(){
var data = {
"@context": "http://schema.org",
"@type": "Recipe",
"author": "Example",
"cookTime": "PT1H",
"description": "Generic description goes here.",
"image": {
"@type": "ImageObject",
"url": {{SCHEMA - Recipe Image}}
},
"recipeIngredient": [
{{SCHEMA - Recipe Ingredient}}
],
"name": {{SCHEMA - Recipe Title}},
"prepTime": "PT15M",
"recipeInstructions": {{SCHEMA - Recipe Steps}}
}
var script = document.createElement('script');
script.type = "application/ld+json";
script.innerHTML = JSON.stringify(data);
document.getElementsByTagName('head')[0].appendChild(script);
})(document);
</script>
描述固定,仍然不能通过变量拉图像的URL,我使用错误的代码? – MattSmiles