【问题标题】:Microdata usage for a blog post博客文章的微数据使用
【发布时间】:2012-10-12 22:47:02
【问题描述】:

我有一个博客页面,但我不确定我是否正确理解了 schema.org 微数据。我有一些我不确定的案例,我认为讨论它们会很好。我的代码:

<body lang="en" itemscope itemtype="http://schema.org/WebPage">
    <section class="blog" itemscope itemtype="http://schema.org/Blog">
        <article class="post" itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
            <header>
                <time class="publish-date" datetime="2011-11-06T13:42:04+01:00" itemprop="datePublished">
                    November 2011
                </time>
                <h1 itemprop="name"><a href=blog/post-slug.html" itemprop="url">
                    My Title Here
                </a></h1>
            </header>

            <section itemprop="description">
                <p>The lead text here</p>
            </section>

            <section itemprop="articleBody">
                <p>The other text here</p>
            </section>

            <footer>
                This article is published by
                <span itemprop="author">
                    John Doe
                </span>
                at 
                <time datetime="2012-10-01T15:33:04+02:00" itemprop="datePublished">
                    1 October 2012 on 15:33
                </time>
                and listed in the category 
                <a href=""><span itemprop="articleSection">
                    My Category
                </span></a>.
                The article is licensed under the <a href="http://creativecommons.org/licenses/by-sa/3.0/" target="_blank">Creative Commons Attribution-ShareAlike 3.0</a>.
            </footer>
        </article>

        <h1>Comments</h1>
        <ul class="comments" itemscope itemtype="http://schema.org/UserComments">
            <li itemprop="comment">
                <span itemprop="creator">Jane Doe</span>
                <time itemprop="commentTime" datetime="2011-05-08T19:30">May 8, 7:30pm</time>
                <article itemprop="commentText">
                    <p>A very good comment here</p>
                </article>
            </li>
        </ul>
    </section>
</body>
  1. 我可以有多个 itemprop 属性吗?我也在制作作者版权所有者,但我不确定这是否可能;
  2. cmets 列表是用户 cmets 范围,单个项目是评论的 itemprop,但我不确定这是否可能;
  3. 我在文章中拆分了前导文本和正文,这样我就可以轻松地列出博客文章。我将前导表示为“描述”,正文表示为(完整?)文章正文,但我不确定 articleBody 是指完整的文本(包括前导)还是没有前导的文本。
  4. 我还有其他错误吗?

非常感谢您的建议和更正!

【问题讨论】:

    标签: html blogs microdata


    【解决方案1】:

    即使是通用的 HTML 语法也禁止在一个元素中使用相同的属性两次。但是,您可以嵌套元素并在嵌套元素中具有相同的属性。

    验证器http://validator.w3.org 还会在您的代码中发现一些其他标记错误。

    似乎没有任何证据表明 schema.org 标记被搜索引擎识别,除非在大型商业或社区网站上找到。

    【讨论】:

    • 我已从作者姓名中删除了copyrightHolder 属性。 &lt;time&gt; 元素在 html5 WHATWG 讨论期间随着时间的推移发生了很大变化,其中 pubdate 首次被允许并且不再(显然)。我已经更新了示例代码,但是我仍然对配置微数据的评论和文章导语/正文类型感兴趣。
    猜你喜欢
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 2011-06-25
    • 2011-09-04
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    相关资源
    最近更新 更多