You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何正确定义JSON-LD的shippingDetails→shippingDestination以排除指定美国州?

解答:JSON-LD中OfferShippingDetails的正确配置方式

你的配置方向完全正确,不需要创建50个shippingDetails实体,Schema.org明确支持通过多个shippingDetails数组元素区分不同区域的发货规则,Screaming Frog的提示属于工具对规范的解读偏差,不用过度在意。

你的代码合理性分析

当前代码逻辑完全符合Schema.org规范:

  • 用单个OfferShippingDetails实体批量标记美国除加州外的所有州为doesNotShip: true,通过addressRegion数组一次性指定多个州,高效且合规
  • 用另一个OfferShippingDetails实体单独标记加州为可发货状态(doesNotShip: false),同时可补充运费、配送时效等具体规则

这种批量处理非目标区域的方式是最优解,无需为每个州单独创建实体。

代码优化建议

  1. 移除子实体中重复的@context:根节点已声明全局上下文,子实体无需重复添加,减少冗余
  2. 确保addressRegion数组包含所有非加州的美国州缩写,避免遗漏

优化后的代码示例:

{
  "@context": "http://schema.org",
  "@type": "Product",
  ...
  "offers": {
    ...
    "shippingDetails": [
      {
        "@type": "OfferShippingDetails",
        "doesNotShip": true,
        "shippingDestination": {
          "@type": "DefinedRegion",
          "addressCountry": "US",
          "addressRegion": [
            "AL","AK","AZ","AR","CO","CT","DE","DC","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY"
          ]
        }
      },
      {
        "@type": "OfferShippingDetails",
        "doesNotShip": false,
        "shippingRate": {
          "@type": "MonetaryAmount",
          "value": 5.99,
          "currency": "USD"
        },
        "deliveryTime": {
          "@type": "ShippingDeliveryTime",
          "handlingTime": {
            "@type": "QuantitativeValue",
            "minValue": 1,
            "maxValue": 2,
            "unitCode": "DAY"
          },
          "transitTime": {
            "@type": "QuantitativeValue",
            "minValue": 2,
            "maxValue": 3,
            "unitCode": "DAY"
          }
        },
        "shippingDestination": {
          "@type": "DefinedRegion",
          "addressCountry": "US",
          "addressRegion": "CA"
        }
      }
    ],
    "priceValidUntil": "2024-12-31T23:59:59-08:00"
  }
}

工具提示说明

Screaming Frog的提示大概率是旧版工具对shippingDetails数组的支持不完善,但Google和Schema.org的官方检测已通过,说明你的配置完全符合搜索收录要求,无需为工具提示调整现有逻辑。

内容的提问来源于stack exchange,提问作者Web Master

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 20:32:42