在互联网上进行一些挖掘之后,我无法找到一个很好的答案,我可以使用哪些字符用于URL片段.我正在编写一个利用URL片段的javascript脚本.
我希望通过不让它看起来太复杂来使URL对眼睛友好.所以我想知道我是否可以使用像':,?,&或'这样的字符.在URL片段中仍然有效.
我的URL片段应包含以下值:
我对网站的语义有点困惑.我知道每个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) 我已经在主页上定义Organization
的WebSite
节点上定义了发布者,现在我想从其他页面上的文章链接到该发布者.但是,我也希望链接到它WebSite
,@id
如果我遵循使用URL作为的建议,他们自然会共享相同的内容@id
.
{
"@context": "http://schema.org",
"@type": "WebSite",
"@id": "http://www.example.com/",
"url": "http://www.example.com/",
...
"publisher": {
"@type": "Organization",
"@id": "http://www.example.com/", <-- duplicated
"url": "http://www.example.com/"
}
}
Run Code Online (Sandbox Code Playgroud)
{
"@context": "http://schema.org",
"@type": "WebPage",
"@id": "http://www.example.com/news",
"url": "http://www.example.com/news",
"isPartOf": {
"@id": "http://www.example.com/" <-- site or publisher?
}
...
"publisher": {
"@id": "http://www.example.com/" <-- site or publisher?
}
}
Run Code Online (Sandbox Code Playgroud)
我假设每个节点的ID必须是唯一的,那么是否有一个最佳实践来统一ID,例如添加哈希?
{
"@id": "http://www.example.com/#site",
...
"publisher": {
"@id": "http://www.example.com/#publisher",
}
}
Run Code Online (Sandbox Code Playgroud)
如果可行的话,处理器(谷歌)会加载@id
以查找节点的其余属性吗?
与此相关的是,url
在许多节点类型中发现的属性是假设@id …