如何引用博客文章使用HTML微数据和schema.org?
我的目标是通过使用
HTML微数据引用博客文章.
如何改进引用的以下标记? 我正在寻求语法和语义的改进,以产生一个效果好的HTML5标准,在当前的浏览器中表现良好,并在搜索引擎中得到很好的解析. 关于这个问题的赏金是专家意见和指导.我的研究提出了许多意见和片段,所以我正在寻求明确的答案,完整的样本和规范的文件. 这是我的工作正在进行中,我正在寻求关于它的正确性的建议: >使用< div class =“citation”>包裹所有东西 这是我正在进行的工作HTML源: <!-- Hello World authored by Alice posted on Bob's blog --> <div class="citation"> <article itemscope itemtype="http://schema.org/BlogPosting"> <header> <h1 itemprop="headline"> <a itemprop="url" href="…"> <cite itemprop="name">Hello World</cite> </a> </h1> </header> <footer> authored by <span itemprop="author" itemscope itemtype="http://schema.org/Person"> <address> <a itemprop="url" rel="author" href="…"> <span itemprop="name">Alice</span> </a> </address> </span> posted on <span itemprop="isPartOf" itemscope itemtype="http://schema.org/Blog"> <a itemprop="url" href="…"> <span itemprop="name">Bob's blog</span> </a> </span> </footer> </article> </div> 到目前为止的相关说明: >< cite>标签W3引用说标签是“短语级别”,所以它的工作方式就像一个内联的跨度,而不是一个块div.但是< article>标签似乎受益于使用< h1>< header>< footer> ;.尽可能地告诉我,规范并没有给出一个解决方案来引用一篇文章,使用< cite>包装< article>.有解决方法吗? (正在进行中的工作通过使用< div class =“citation”>) 请在评论中提问.我会更多地了解这篇文章. 解决方法
如果你问我哪个标记用于博客文章(
OP’s context)的链接列表,没有看到你的例子,我会去这样的东西:
<body itemscope itemtype="http://schema.org/WebPage"> <ul> <li> <cite itemprop="citation" itemscope itemtype="http://schema.org/BlogPosting"> <a href="…" itemprop="url" rel="external"><span itemprop="name headline">Hello World</span></a>,authored by <span itemprop="author" itemscope itemtype="http://schema.org/Person"><a href="…" itemprop="url" rel="external"><span itemprop="name">Alice</span></a></span>,posted on <span itemprop="isPartOf" itemscope itemtype="http://schema.org/CreativeWork"><a href="…" itemprop="url" rel="external"><span itemprop="name">Bob’s blog</span></a></span>. </cite> </li> <li> <cite itemprop="citation" itemscope itemtype="http://schema.org/BlogPosting">…</cite> </li> </ul> </body> 使用分段内容元素 另一个迹象表明,分段内容元素可能不是最佳选择:您的文章不包含任何实际的“主”内容.简单地说,分割内容元素的主要内容可以通过剥离其元数据来确定:页眉,页脚和地址元素. (这不是明确指定的,而是从0703的定义开始) 但是,没有这个内容没有错.你可以很容易地想象(也许你打算这么做),你会引用博客帖子(这个案例similar to a search result entry)的代码段,在这种情况下你会有: <article> <header></header> <blockquote></blockquote> <!-- the non-metadata part of the article --> <footer></footer> </article> 我会进一步假设你想使用文章. 关于您的HTML5的注意事项 >语义上,不需要包装div.您可以直接向文章添加引文类. 关于您的Microdata的注意事项: >您可以指定Schema.org属性标题和名称in the same 以你的榜样,这将给出: <body itemscope itemtype="http://schema.org/WebPage"> <article itemprop="citation" itemscope itemtype="http://schema.org/BlogPosting" class="citation"> <header> <h1> <cite itemprop="headline name"><a itemprop="url" href="…" rel="external">Hello World</a></cite> </h1> </header> <footer> authored by <span itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href="…" rel="external"><span itemprop="name">Alice</span></a> </span> posted on <span itemprop="isPartOf" itemscope itemtype="http://schema.org/Blog"> <a itemprop="url" href="…" rel="external"><span itemprop="name">Bob’s blog</span></a> </span> </footer> </article> </body> (所有考虑的事情,我仍然喜欢无断面的变体.) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |