请看这里:https://developers.google.com/structured-data/testing-tool?url = https%253A%252F%252Fglamourina.net%252Fen%252F
如何正确添加mainEntityOfPage到此站点?
在Google文档示例中,我看到如下内容:
<div itemscope itemtype="http://schema.org/NewsArticle">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="https://google.com/article"/>
Run Code Online (Sandbox Code Playgroud)
但这是一篇单独的作者博客.它的特色是blogPosts.
<article itemscope itemtype="https://schema.org/BlogPosting" class="singlearticles">
Run Code Online (Sandbox Code Playgroud)
如果我这样改变它会是好的:
<article itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<meta itemscope itemprop="mainEntityOfPage" itemType="https://schema.org/WebPage" itemid="https://linktoarticle"/>
Run Code Online (Sandbox Code Playgroud)
不确定我是否理解其mainEntityOfPage用法.如果有人可以建议我如何处理这个特定的案例/网站,我将不胜感激.不一般,因为每个站点可以有不同的mainEntityOfPage,但我需要知道并理解该站点的正确实现.
我对网站的语义有点困惑.我知道每个URI都应该代表一个资源.我假设RDFa在网页内提供的所有信息都描述了该网页的URI所代表的资源.我的问题是:为网站的子页面提供语义数据的最佳做法是什么.
在我的情况下,我想使用带有schema.org和opengraph词汇表的RDFa为一个名为magma的剧院组创建一个网站.假设我有欢迎页面(http://magma.com/),联系页面(http://magma.com/contact/)和各个游戏的页面(http://magma.com/play/<playid>/).
现在我认为欢迎页面和联系页面都代表相同的资源(岩浆),同时提供有关该资源的不同信息.然而,剧本页面代表恰好由岩浆执行的剧本.或者更好地说,游戏页面也代表了岩浆,但提供了由该组执行的游戏信息?我偶然发现的第三个选项是http://schema.org/WebPage.特别是类似的亚型ContactPage似乎是相关的.
在实现方面,我在哪里放置RDFa?
最后:我的选择将如何改变第三方(谷歌,脸谱,...)对待网站的方式?
我意识到这个问题有点模糊.为了使它更具体,我将添加一个你可能会批评的例子:
<html vocab="http://schema.org/" typeof="TheaterGroup">
<head>
<meta charset="UTF-8"/>
<title>Magma - Romeo and Juliet</title>
<!-- magma sematics from a template file -->
<meta property="name" content="Magma"/>
<meta property="logo" content="/static/logo.png"/>
<link rel="home" property="url" content="http://magma.com/"/>
</head>
<body>
<h1>Romeo and Juliet</h1>
<!-- semantics of the play -->
<div typeof="CreativeWork" name="Romeo and Juliet">
...
</div>
<h2>Shows</h2>
<!-- samantics of magma events -->
<ul property="events">
<li typeof="Event"><time property="startDate">...</time></li>
...
</ul>
</body> …Run Code Online (Sandbox Code Playgroud) 我想知道使用片段标识符格式引用实体是否更好/适当 - 基本上是通过在名称前插入哈希
[url] + # + [name] => http://example.com/page/#webPage
编辑:
根据来自慷慨和伟大的@Unor的回复,我添加了这个编辑以试图限制我的查询范围并澄清我遇到的主要问题.我还删除了大部分原始问题(大约95%)(事后看来)我觉得有缺点:1.我的核心问题; 2.对未来读者的好处.
这是我的问题:
在微数据的itemid和json-ld的@id值开始时手动键入哈希的做法是否有效?
以下是我更详细的问题:
我可以在微数据的itemid值和json-ld的@id值中插入HASH符号(#),以便通过正确有效地使用片段标识符来创建有效的结果URI吗?
所以,如果这是在网页上:
<div itemscope itemtype="http://www.schema.org/Person" itemid="#joe"></div>
Run Code Online (Sandbox Code Playgroud)
或者,如果这也在网页上:
{"@context":"http://schema.org",
"@type":"Person",
"@id":"#Joe"}
Run Code Online (Sandbox Code Playgroud)
我知道他们会被读到这样的uri(假设消费者的相对构造是谷歌的结构化数据测试工具):
http://www.example.com/page#joe
Run Code Online (Sandbox Code Playgroud)
那是uri:
有效的uri; 和
是否正确使用片段标识符(HASH)?
schema.org 文档有时会提到“指针”。例如Product模式具有属性isSimilarTo。
我明白,我可以直接使用 aProduct或 a Service。例如:
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": "BMW",
"isSimilarTo": {
"@type": "Product",
"name": "Mercedes Benz"
},
"offers": {
"@type": "Offer",
"priceCurrency": "EUR",
"price": "100000.00"
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是在这种情况下使用和解释术语“指针”的唯一且正确的方法吗?对于指针,我宁愿期望一些值(ID 或 URL 或类似的)只是指向另一个产品或服务。
我在一个多语言网站上工作,我正在使用 JSON-LD 准备 Schema.org 标记。重要细节:本网站使用语言子目录。让我们考虑两种语言:
https://www.example.com/https://www.example.com/fr/我想把Corporation和WebSite东西放在所有本地化的惠普上。一切正常,但对于@id,url和inLanguage属性:我不太知道我应该填写什么。
对于Corporation,我想我是对的:我将在所有页面上使用默认 url 并以此为基础@id:
{
"@context": "http://schema.org",
"@type": "Corporation",
"@id": "https://www.example.com/#organization",
"name": "Example",
"url": "https://www.example.com/",
...
Run Code Online (Sandbox Code Playgroud)
但是WebSite,在我的法国 HP 上,房地产的最佳举措是什么?从技术上讲,/fr/子文件夹是example.com/域的一部分。但是@id,inLanguage并url没有告诉我的网站也适用于讲法语的人。
{
"@context": "http://schema.org",
"@type": "WebSite",
"@id": "https://www.example.com/#website", // should this be "https://www.example.com/fr/#website" ?
"name": "Example",
"url": "https://www.example.com/", // should this be "https://www.example.com/fr/" ?
"inLanguage": "en", // …Run Code Online (Sandbox Code Playgroud) multilingual localization structured-data schema.org json-ld
我想知道如何构建我的 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 …
json-ld ×4
schema.org ×4
microdata ×3
iri ×1
localization ×1
multilingual ×1
rdfa ×1
semantic-web ×1
uri ×1