标签: json-ld

Schema.org JSON-LD参考

我有一个关于在另一个JSON-LD schema.org标记中引用JSON-LD schema.org标记的问题.我有一个主要事件的页面位于,http://event.com/这里是JSON-LD标记.

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "MainEvent",
  "startDate": "2016-04-21T12:00",
  "location": {
    ...
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

主事件有多个子事件,例如http://event.com/sub-event-1/,这里是JSON-LD标记:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "SubEvent",
  "startDate": "2016-04-21T12:00",
  "location": {
    ...
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

我要做的是将子事件标记为主事件的一部分.是否可以创建从主事件到子事件的引用?像这样的东西:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "SubEvent",
  "startDate": "2016-04-21T12:00",
  "location": {
    ...
  }
  superEvent {
    "url": "http://event.com/"
  }
}
</script>
Run Code Online (Sandbox Code Playgroud)

如果可能,什么是正确的标记供参考.我找不到任何有关它的信息.

或者是否需要在每个SubEvent中嵌入MainEvent,如下所示:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Event",
  "name": "SubEvent",
  "startDate": "2016-04-21T12:00",
  "location": { …
Run Code Online (Sandbox Code Playgroud)

schema.org json-ld

8
推荐指数
2
解决办法
6352
查看次数

无论如何使用JSON-LD Schema没有内联

无论如何使用JSON-LD而不script在HTML中包含内联,但仍然可以让Google(和其他)蜘蛛找到它吗?环顾四周,我看到了一些相互矛盾的信息.

如果这是JSON-LD文件:

    <script type="application/ld+json">
    {
      "@context" : "http://schema.org",
      "@type" : "WebSite",
      "name" : "Example Site",
      "alternateName" : "example",
      "description" : "Welcome to this WebSite",
      "headline" : "Welcome to Website",
      "logo" : "https://example.com/public/images/logo.png",
      "url" : "https://example.com/"
    }
    </script>
Run Code Online (Sandbox Code Playgroud)

head在HTML中有这个:

<script src="/public/json-ld.json" type="application/ld+json"></script>
Run Code Online (Sandbox Code Playgroud)

编辑:我也尝试过:

<link href="/public/json-ld.json" rel="alternate" type="application/ld+" />
Run Code Online (Sandbox Code Playgroud)

谷歌蜘蛛似乎很想念它,测试工具也是如此,除非我直接指向该文件.我正在努力解决CSP中的不安全内联问题.我唯一能找到的就是这个,它可以在Chrome中运行,但不希望在每个其他浏览器上触发控制台错误.另外,我只是喜欢从页面结构中抽象出Schema.org数据的想法.将JSON-LD添加到Google网站站长工具的站点地图会有帮助吗?

道歉,JSON-lD的总菜单,并最终保留在电子邮件文档(这将是一个站点)或旧文档.

seo schema.org content-security-policy json-ld

8
推荐指数
1
解决办法
988
查看次数

json-schema:如何从一个 json-schema 转换到另一个

我有两种不同的json-schemas

schemaA -> 在http://json-schema.org/calendar定义的日历

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "A representation of an event",
    "type": "object",
    "required": [ "dtstart", "summary" ],
    "properties": {
        "dtstart": {
            "format": "date-time",
            "type": "string",
            "description": "Event starting time"
        },
        "dtend": {
            "format": "date-time",
            "type": "string",
            "description": "Event ending time"
        },
        "summary": { "type": "string" },
        "location": { "type": "string" },
        "url": { "type": "string", "format": "uri" },
        "duration": {
            "format": "time",
            "type": "string",
            "description": "Event duration"
        },
        "rdate": {
            "format": "date-time",
            "type": …
Run Code Online (Sandbox Code Playgroud)

javascript templates jsonschema json-ld

8
推荐指数
2
解决办法
9633
查看次数

在JSON-LD中使用相同谓词消除歧义资源

我无法预先确定如何消除使用相同谓词的资源的歧义.我是RDF的新手,所以请原谅我的术语:我会试着用例子来解释我的意思.

我有一个Interview资源/模型与(简化)上下文,如下所示:

{
  "id": {
    "@id": "http://purl.org/dc/terms/identifier"
  },
  "interviewers": {
    "@id": "http://purl.org/dc/terms/contributor",
    "@type": "@id",
    "@container": "@set"
  },
  "title": {
    "@id": "http://purl.org/dc/terms/title"
  },
  "interviewees": {
    "@id": "http://purl.org/dc/terms/contributor",
    "@type": "@id",
    "@container": "@set"
  }
}
Run Code Online (Sandbox Code Playgroud)

InterviewerInterviewee资源有这样的情境:

{
  "id": {
    "@id": "http://purl.org/dc/terms/identifier"
  },
  "name": {
    "@id": "info:repository/ive/name"
  }
}
Run Code Online (Sandbox Code Playgroud)

然后我创建一个如下所示的资源:

{
  "id": "06bad25f-83c1-4ee5-b055-0cb87d4c06be",
  "interviewers": [
    {
      "id": "b0c262ce-7eb3-47f2-b212-a0e71cca0c92",
      "name": "Somebody",
      "@context": {
        ...
      },
      "@id": "urn:uuid:b0c262ce-7eb3-47f2-b212-a0e71cca0c92",
      "@type": [
        "http://id.loc.gov/vocabulary/relators/ivr"
      ]
    }
  ],
  "title": "Interview with So and So", …
Run Code Online (Sandbox Code Playgroud)

ruby rdf json-ld

7
推荐指数
1
解决办法
511
查看次数

是否可以保护 JSON-LD 免受电子邮件收集器的攻击?

我想将 JSON-LD 用于 SEO 目的,但不确定如何防止自动电子邮件收集器从源中获取地址。

电子邮件架构中,您提供一个电子邮件地址。我总是通过使用 JS 或其他方法来以某种方式混淆电子邮件地址。到目前为止,这有助于阻止垃圾邮件。

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person",
  "address": {
    "@type": "PostalAddress",
    "addressLocality": "Seattle",
    "addressRegion": "WA",
    "postalCode": "98052",
    "streetAddress": "20341 Whitworth Institute 405 N. Whitworth"
  },
  "colleague": [
    "http://www.xyz.edu/students/alicejones.html",
    "http://www.xyz.edu/students/bobsmith.html"
  ],
  "email": "mailto:jane-doe@xyz.edu",
  "image": "janedoe.jpg",
  "jobTitle": "Professor",
  "name": "Jane Doe",
  "telephone": "(425) 123-4567",
  "url": "http://www.janedoe.com"
}
</script>
Run Code Online (Sandbox Code Playgroud)

我能想到的唯一方法是使用 JS 动态创建上述内容,我希望收割机在大多数情况下无法解释,但这很可能会破坏搜索引擎的支持。有什么解决办法吗?

email spam-prevention schema.org json-ld

7
推荐指数
1
解决办法
508
查看次数

JSON-LD和JSON Schema有什么区别?

我和JSON一样新.我知道JSON-LD和JSON Schema都用于验证JSON数据.然而,我找不到比较和对比两者的更多信息.

哪一个更好?
为什么用一个而不是另一个?
优点与劣势?
这两者甚至可以比较吗?
我误解了JSON-LD和JSON Schema是什么?

json json-ld

7
推荐指数
1
解决办法
2301
查看次数

JSON-LD:值是否必要?

我目前正致力于在/ about-page中添加Web应用程序的结构化数据.我想在那里添加一个属性.在下面的代码中,我正在使用和(正如我在schema.org中看到的那样).namevalue

问:我必须只使用value不带name,并设置如Modularityvalue拖放的描述?

<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "product",
"name":"Product_name",
"additionalProperty":
    {
    "@type":"propertyValue",
    "name":"Main features",
    "value":
        [
            {
            "@type":"propertyValue",
            "name": "Detailed documentation",
            "value": "description_of_the_documentation"
            },  
            {
            "@type":"propertyValue",
            "name": "Fully responsive",
            "value": "description_of_the_responsiveness"
            }
        ],

    "@type":"propertyValue",
    "name":"Other features",
    "value":
        [
            {
            "@type":"propertyValue",
            "name": "Modularity",
            "value": "description_of_the_modularity"
            },  
            {
            "@type":"propertyValue",
            "name": "Frequent updates",
            "value": "description_of_the_updates"
            }
        ]
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)

json structured-data schema.org json-ld

7
推荐指数
1
解决办法
196
查看次数

在客户端React中添加ld + json脚本标签

我目前已经构建了一个React应用。由于它是SPA,因此只有一个index.html文件。我想添加2个“ ld + json” script标签,即用于特定路线的评论和书签。

我已经将该script标签注入了componentDidMount该组件,但是Google结构化数据测试工具无法读取该标签。

是因为Google直接从index.html读取并且由于我的script标签被捆绑在main.js中,所以它无法读取它?

可以在客户端React中做到这一点吗?服务器端渲染是唯一可行的方法吗?

-详细说明----我目前想实现像IMDB这样的系统,即每当我们在goole中搜索电影时,IMDB搜索结果将在Google页面本身中显示电影的评级。为此,我需要将脚本放入index.html文件中

<script type='application/ld+json'>
  {
      "@context": "http://schema.org/",
      "@type": "Review",
      "itemReviewed": {
        "@type": "Thing",
        "name": "Name"
      },
      "reviewRating": {
        "@type": "Rating",
        "ratingValue": "3",
        "bestRating": "5"
      },
      "publisher": {
        "@type": "Organization",
        "name": "1234"
      }
    }
</script>
Run Code Online (Sandbox Code Playgroud)

由于我的应用程序是SPA,因此无法将其放在主index.html文件中。

我当前的方法:假设“ / movies / inception”路由呈现“ MovieDetail”组件。因此,我目前正在将该脚本添加到该组件的末尾。

import React from 'react';
import JsonLd from '../path_to_JSONLD';

class MovieDetail extends React.Component {
 render(){
 let data = {
  "@context": "http://schema.org/",
  "@type": "Review",
  "itemReviewed": {
    "@type": …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs json-ld google-rich-snippets

7
推荐指数
4
解决办法
4245
查看次数

使用 JSON-LD 和 Schema.org 词汇的简历(工作历史和组织)格式

假设您有一个个人资料页面,其中mainEntity包含Person. 您想列出该人的工作和教育经历,类似于简历。

Schema.org 的Occupation示例 4说明了如何使用RolehasOccupation关联工作历史记录数组,如下所示:

{
    "@context": "http://schema.org",
    "@type": "Person",
    "name": "Jane Smith",
    "sameAs": "http://en.wikipedia.org/wiki/Jane_Smith",
    "worksFor": {
        "@type": "Organization",
        "name": "McKinsey & Company",
        "url" : "http://www.mckinsey.com"
    },
    "hasOccupation": [ {
          "@type": "Role",
          "hasOccupation": {
            "@type": "Occupation",
            "name": "Management Consultant"
          },
          "startDate": "2016-04-21"
        }, {
          "@type": "Role",
          "hasOccupation": {
            "@type": "Occupation",
            "name": "Chief Strategic Officer"
          },
          "startDate": "2013-11-14",
          "endDate": "2016-03-22"
        }, {
          "@type": "Role",
          "hasOccupation": {
            "@type": "Occupation",
            "name": "Vice …
Run Code Online (Sandbox Code Playgroud)

schema.org json-ld

7
推荐指数
1
解决办法
1350
查看次数

Incorrect value type "@context" in Google Rich Results Test

Im pretty new to JSON-LD and am currently struggling making the Google Rich Results Test happy with my custom JSON-LD data.

Every time I use a @context other than https://schema.org/ it shows me the error Incorrect value type "@context".

This even happens with this simple example based on a json-ld.org context:

<script type="application/ld+json">
{
  "@context": "https://json-ld.org/contexts/person.jsonld",
  "@type": "Person",
  "name": "Foo"
}
</script>
Run Code Online (Sandbox Code Playgroud)

Rich Results Test Error

After some trail and error I found out that with the following code the json-ld.org/playground shows me …

json-ld google-rich-snippets

7
推荐指数
1
解决办法
144
查看次数