我的目标是通过使用HTML微观举一个博客帖子。
我怎样才能提高引用下面的标记?
我要求的语法和语义的改进,生产与HTML5标准的效果很好,在现有的浏览器渲染很好,在搜索引擎解析很好的结果。
关于这个问题的赏金是专家咨询和指导。我的研究转向了许多意见和片段,所以我在寻找明确的答案,完整的样本,并规范文档。
这是我的工作正在进行中,我寻求建议在它的正确性:
<div class="citation">
包一切。<article>
与itemscope
和BlogPost
包裹邮寄信息,包括其嵌套的信息。<header>
和<h1 itemprop="headline">
包裹后名称的链接。<cite>
包装后的名称。<footer>
包裹作者信息和博客信息。<address>
包裹笔者链接和名称。rel="author"
注释链接到作者的名字。itemprop="isPartOf"
到后连接到博客。这是我在进步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参考说,标签是“短语水平”,因此它就像一个内嵌跨度,而不是块股利。但<article>
标签似乎使用<h1>
,<header>
,<footer>
受益。作为最好的,我可以告诉,该规范并没有给出一个解决方案,通过使用<cite>
包装<article>
引用的文章。是否有这个或替代方法解决? (正在进行的工作,通过使用<div class="citation">
呓语这一点)<address>
标签W3参考称内容“的地址元素不能被用来表示任意地址,除非这些地址其实都是相关的联系信息。”作为最好的,我可以告诉,该规范并没有给出一个解决方案,标志着该文作者的网址和名称,从文章的联络信息是不同的。是否有这种或替代方法解决? (正在进行的工作,通过使用<address>
为作者的网址和名称呓语这一点)请向在评论的问题。因为我了解我会更新这个帖子。
如果你问我哪个标记用于链接到博文(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>
使用切片内容元素article
,就像在你的榜样,当然是可能的,尽管也许不寻常的(如果我正确理解你的使用情况):作为article
是切片内容元素,它会在文档大纲的条目,可能会或可能不是你想要什么,你的情况。 (您可以check the outline with the HTML5 Outliner,例如。)
一个切片内容元素未必是最好的选择另一个标志:您article
不包含任何实际的“主”的内容。简单地说,一个切片内容元素的主要内容可以通过汽提其元数据来确定:header
,footer
,和address
元素。 (这不是一个显式指定,但它从在Sections的defintions如下。)
但是,没有这个内容是没有错的。人们可以很容易想象(也许你打算这样做反正),你会引述博客文章(使这种情况下similar to a search result entry),在这种情况下,你就会有一个片段:
<article>
<header></header>
<blockquote></blockquote> <!-- the non-metadata part of the article -->
<footer></footer>
</article>
我会进一步对假设你想使用article
。
有关HTML5的注意事项:
div
。您可以直接在citation
类添加到article
。header
element是optional if it just contains a heading element(这个元素是有意义的,当你的头部由不仅仅是一个标题元素更多)。然而,有它是没有错的,当然。a
的cite
element元件(在spec类似于第五实施例)。span
元素只能包含phrasing content,所以address
不允许作为一个孩子。address
element。所以,如果这个元素是合适取决于什么是可在链接页面:如果它是一个接触的形式,是的;如果它是撰写博客文章列表,没有。author
link type可能不适合,因为它的定义给出关于article
元素的作者信息。不过,严格来说,你是作者。如果article
将仅由博客文章作者的实际内容,使用author
链接类型将是适当的;但在你的情况,你正在写的内容(“由创作”,“上发布”)。external
link type的all external links。有关微观数据的注意事项:
headline
和name
in the same itemprop
(separated with space)。citation
property在article
(这需要指定CreativeWork
或其子类型之一的父类型;也就是说,它可以在你的情况,甚至WebPage
AboutPage
或可能)。以你的榜样,这将给:
<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>
(所有的事情考虑,我还是比较喜欢的部分少的变体。)