-->

Schema.org for closed on a holiday / given date

2020-07-31 07:49发布

问题:

How do I properly markup holiday hours when a business is closed on the holiday?

Normal holiday hours markup example:

<li itemprop="openingHoursSpecification" itemscope="" itemtype="http://schema.org/OpeningHoursSpecification" class="holidayHours">  
  <span itemprop="validFrom" content="2014-05-26">Memorial Day Hours, Monday, May 26th:&nbsp;</span>  
  <span itemprop="validThrough" content="2014-05-26"></span>  
  <span itemprop="opens" content="09:00">9 am</span>&nbsp;-&nbsp;<span itemprop="closes" content="15:00">3 pm</span>  
</li>

What is the schema.org or Google preferred way to show closed on a holiday? Would this be correct?

<li itemprop="openingHoursSpecification" itemscope="" itemtype="http://schema.org/OpeningHoursSpecification" class="holidayHours">  
  <span itemprop="validFrom" content="2014-05-26">Memorial Day Hours, Monday, May 26th:&nbsp;</span>  
  <span itemprop="validThrough" content="2014-05-26"></span>  
  <span itemprop="opens" content="00:00">CLOSED<span itemprop="closes" content="00:00"></span>  
</li>

回答1:

This is the ld+json format, but say you are closed for Christmas, just leave the opening & closed hours blank, like I did for regular openingHours below. This test business is closed Sunday, so I just don't enter any time for it at all.

 ...
 "telephone": "123-555-1212",
 "openingHours": "Mo,Tu,We,Th 09:00-19:00, Fr 09:00-20:00, Sa 09:00-18:00",
 {
     "@type": "OpeningHoursSpecification",
     "validFrom": "2015-12-25",
     "validThrough": "2015-12-25"
  },
  "address": {
      ...
  }


回答2:

Don't know if things has changed since you posted this @Nathan but this is the only way I could get https://developers.google.com/structured-data/testing-tool/ to validate properly. By specifying "openingHoursSpecification" outside of the brackets.

"openingHours": "Mo,Tu,We,Th 09:00-19:00, Fr 09:00-20:00, Sa 09:00-18:00",
"openingHoursSpecification":
        {
            "@type": "OpeningHoursSpecification",
            "validFrom": "2015-12-25",
            "validThrough": "2015-12-25"
        }


回答3:

You could possibly handle it that way, Christopher, but you need to mark up the time down to the seconds (00:00:00) in this situation. It's because the business would open at 00:00:00 and close at 00:00:01. Or another way to do it would be simply to specify the days of the year that the business is open and leave out any mark up for the days that the business is closed.