如何访问 JSON-LD 中的两个单独的词汇,我可以使用 2 个 @contexts 吗?例如
{
"@context": {
"@vocab": "http://schema.org/",
"first_name": "givenName",
"last_name": "familyName
}
"@context": {
"@vocab": "http://our_own_schema.org/",
"Time": "inputTime"
}
}
Run Code Online (Sandbox Code Playgroud) 在RESTful Web API一书中,作者建议公开一个配置文件并使用一种确认链接关系的内容类型.Hydra扩展的JSON-LD似乎符合这些要求,我想在我的新API设计中使用它们.
我目前遇到性能问题.假设我有一个在线自行车商店,我想要检索有关给定自行车车轮的信息.
根据Hydra规范,在我看来,我需要发送2个请求来获取有关车轮的详细信息.第一个要求是自行车本身:
GET /mybike HTTP/1.1
Host: wowbike.com
Run Code Online (Sandbox Code Playgroud)
响应包含一个Hydra :: Link到轮子集合:
HTTP/1.1 200 OK
Content-Type: application/ld+json
{
"@context" :
{
"Bike": "/contexts/vocab#Bike"
},
"@id" : "/mybike",
"@type" : "Bike",
"size" : "L",
"wheels" : "/mybike/wheels" // "wheels" is a "hydra:Link"
}
Run Code Online (Sandbox Code Playgroud)
现在我可以向wheel资源发送第二个请求以获取详细信息:
GET /mybike/wheels HTTP/1.1
Host: wowbike.com
HTTP/1.1 200 OK
Content-Type: application/ld+json
{
"@context":
{
"Collection": "http://www.w3.org/ns/hydra/core#Collection",
"Wheel" : "/contexts/vocab#Wheel"
},
"@type" : "Collection",
"@id" : "/mybike/wheels",
"member" :
[
{
"@id" : "/mybike/wheels/firstwheel", …Run Code Online (Sandbox Code Playgroud) 我想为网站启用Google Sitelinks Search Box.关键是它的自定义搜索页面是由哈希片段实现的,所以JSON-LD数据片段是这样的:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"name" : "my site",
"alternateName" : "example.com",
"url": "http://www.example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://www.example.com/Search/#!/Keyword-{search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
当Google尝试从此部分提取信息"required name=search_term_string"以显示附加链接搜索框时,遇到问题:
: http://schema.org/True
valueName: missing and required
Run Code Online (Sandbox Code Playgroud)
我怀疑Google可能只是期望查询字符串中的搜索字符串而不是散列片段,除了重定向之外你还建议什么?
我有一些jQuery代码构造一个名为的数组myList[].这个数组出现在控制台中,如下所示:["2 items", "3items", "so on"]所以这部分进展顺利.
<script type="text/javascript">
var myList = [];
function buld myList(){
...
}
Run Code Online (Sandbox Code Playgroud)
我需要传递myList[]给application/ld+json像
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Recipe",
"recipeIngredients": myList, //this one doesn't work
}
Run Code Online (Sandbox Code Playgroud)
..
如何将值从javascript传递给application/ld+json?提前致谢!
我想删除Yoast应用于我的WordPress网站的JSON-LD架构,以便我可以添加自己的.我已经添加了自己的,Google结构化数据测试说它没关系,但基本上我有3个独立的JSON-LD模式,而不是两个因为Yoast.
你可以在这里看到我的意思:https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fwww.yogabearpc.com
Yoast添加了WebSite架构,似乎没有必要甚至是破坏性的?
我正在尝试创建谷歌的结构化数据,但不知道我在做什么。我将其设置为一个组织,然后对我的所有产品使用 SD 标记工具。我将每个 JSON-LD 产品直接从标记工具与嵌套放入其自己的脚本标签中。然后我将其放入服务器上的 .js 文件中。我在我的标题中将其与此链接
<script src="../Scripts/structureddata.js"></script>
Run Code Online (Sandbox Code Playgroud)
我已经使用 url 在 SD 工具中对其进行了测试,但没有看到它。然后我将 StructuredData.js 复制到该工具中,它是这么说的,然后我纠正了它显示我的 50 个产品的所有警告和错误。再次尝试,从 url 中看不到它。我可以在 Search Console 中看到它,它显示 1 个项目。我“假设”阅读它只显示一个......?
谁能帮我这个。我应该把它放在 .js 文件中吗?我可以使用 .js 文件的链接吗?为什么 SD 工具看不到链接文件中的结构化数据?
我想知道如何构建我的 Schema.org。我对 JSON-LD 和微数据元素使用混合方法。我不使用它们以两种不同的方式来描述一件事。我需要一些关于包含哪些内容的指南。
现在我在每一页都有对我们公司的描述:
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "Organization",
"url" : "https://our.url",
"logo" : "https://our.url/logo2.svg",
"contactPoint" : [{
"@type" : "ContactPoint",
"telephone" : "",
"contactType" : "Customer Service"
}],
"sameAs" :[],
"name" : "Our Small Company"
}
</script>
Run Code Online (Sandbox Code Playgroud)
然后我在 JSON-LD 中再次对我们的网页进行了简短的描述:
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"url" : "http://our.url",
"potentialAction" : {
"@type" : "SearchAction",
"target" : "http://our.url/search",
"query-input" : "required name=search_term_string"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
从这里开始,我拥有所有元素的微数据。例如搜索结果是带有产品的 ItemList 等。
这看起来好吗?我应该在每个页面上包含 JSON-LD …
我有一个描述旅游景点的页面 ( TouristAttraction)。由于我还想添加面包屑信息,因此我也需要添加WebPage。
添加两个信息的方法是什么:
WebPage并添加TouristAttractionasmainEntity吗?script使用单独的
WebPage和TouristAttraction块创建 2 个单独的 JSON-LD块吗?当使用 2 个实体时:
我正在尝试使用 Nuxt.js 在一个脚本标记中返回多种类型的结构化。我正在使用这个插件: https: //github.com/ymmooot/nuxt-jsonld
在我的网站https://kassebil.dk/ford-kassebil/ford-transit-custom上,您可以看到这已经适用于以下代码:
jsonld() {
const { brand, modelTitle, seoText, modelImage } = this.modelInfo
const price = this.lowOffer
return {
'@context': 'https://schema.org',
'@type': 'product',
'brand': `${brand}`,
'model': `${modelTitle}`,
'name': `${modelTitle}`,
'description': `${seoText.replace(/<[^>]*>?/gm, '')}`,
'image': `https://res.cloudinary.com/kassebil/image/upload/${modelImage}`,
'url': `https://kassebil.dk${this.$route.path}`,
'offers': {
'@type': 'AggregateOffer',
'lowPrice': `${price}`,
'priceCurrency': 'DKK'
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我希望为常见问题解答模式添加另一个模式。我根本不明白这是如何工作的。你能帮助我吗?
如何使用Schema.org定义电话类型?
例如,我想在Json-ld中有这个:
"phones" : [
{
"type" : "office",
"number" : "123456789"
},
{
"type" : "work",
"number" : "123456789"
}
]
Run Code Online (Sandbox Code Playgroud)
有没有办法使用schema.org作为上下文来定义这些?我查看了FOAF或goodRelations,但他们都只使用一部电话:http://schema.org/telephone
json-ld ×10
schema.org ×6
http ×1
hydra-core ×1
hypermedia ×1
javascript ×1
jquery ×1
microdata ×1
nuxt.js ×1
rest ×1
seo ×1
wordpress ×1