在 HTML 网站中实现结构化模式 [英] Implement structured schema in HTML website

查看:27
本文介绍了在 HTML 网站中实现结构化模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的网站实施结构化数据 (schema.org).

I am implementing structured data (schema.org) for my website.

我一直在输入 ratingValuereviewCount 以及我能够动态输入的所有其他内容.

I am stuck at putting in ratingValue and reviewCount, everything else I am able to put in dynamically.

"review": [
    {
        "@type": "Review",
        "reviewRating":{
            "@type": "Rating",
            "ratingValue": "4",
            "bestRating": "5"
        },
        "author":{
            "@type": "Organization",
            "name": "xyz"
        }
    }
],
"aggregateRating": 
{
    "@type": "AggregateRating",
    "ratingValue": "3.7",
    "reviewCount": "15"
}

我可以将reviewCountratingValue 放在哪里?我们不会要求客户提供任何评论/评分

Where I can put reviewCount and ratingValue? We are not asking our customers to give any reviews/ratings

推荐答案

我认为在您的情况下使用 AggregateRating 没有意义,因为(假定的)网站作者只有一个评论.聚合"基本上意味着集合的摘要",因此使用 AggregateRating 您是在声明存在或可能有多个评论 - 而不仅仅是一个.

I think in your case using AggregateRating doesn't make sense, since there's only a single review by the (assumed) website author. "Aggregate" basically means "the summary of a collection", so to use AggregateRating you're stating there are or could be multiple reviews - not just a single one.

假设这是一个 Product,我会改用这个标记:

Assuming this is a Product, I would instead use this markup:

{
    "@context": "https://schema.org/",
    "@type": "Product",
    "name": "Some Product",
    "description": "This is some product",
    "review": {
        "@type": "Review",
        "author": {
            "@type": "Organization",
            "name": "xyz"
        },
        "reviewRating": {
            "@type": "Rating",
            "bestRating": "5",
            "ratingValue": "4",
            "worstRating": "1"
        }
    }
}

AggregateRating结构化数据测试工具 是推荐的,但不是必需的.

AggregateRating in the Structured Data Testing Tool is recommended, but not required.

如果由于某种原因你必须在这个项目中使用 AggregateRating,那么你可以将 reviewCount 硬编码为 1 并设置 ratingValue 到您已经拉入 reviewRating 的值.然而,这又违背了 AggregateRating 的目的.

If for some reason you have to use AggregateRating in this project, then you could hardcode the reviewCount as 1 and set the ratingValue to the value you're already pulling into reviewRating. Again though, that defeats the purpose of AggregateRating.

这篇关于在 HTML 网站中实现结构化模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆