11

I was reading Google documentation on how to impletement Sitelinks Search Box. In the example, they use

itemscope itemtype="http://schema.org/WebSite"

to implement sub-properties like potentialAction, etc.

However, after reading the schema documentation CreativeWork it looks to me that WebSite is inferior to WebPage.

  • They inherit the same properites from CreativeWork
  • WebPage has its own properties, while WebSite doesn't

Is there a scenario where WebSite should be used / is preferable?

Vivek Mahajan
  • 95
  • 1
  • 13
gskema
  • 3,141
  • 2
  • 20
  • 39

1 Answers1

10

WebSite represents a web site, WebPage represents a web page (like the difference between Blog and BlogPosting).

The additional properties from WebPage (like breadcrumb and mainContentOfPage) wouldn’t necessarily make sense for WebSite.

Google’s Sitelinks Search Box uses WebSite because the search usually applies to the whole site, not just a single page.

unor
  • 92,415
  • 26
  • 211
  • 360
  • So what if I need to put `WebSite` on body to use `potentialAction`, but I also want props from `WebPage`? Can I nest these items? – gskema Apr 27 '15 at 07:35
  • @gskema: Yes, you can have several items in a document (it doesn’t matter if you nest them or not, unless you have a property to relate them). – unor Apr 27 '15 at 07:49
  • Still unclear to me on how to proceed. Should I maintain hierarchy and put `WebSite` on html or body once, and put `WebPage` once immediatelly after? Or should I use `WebSite` and `WebPage` multiple times whevever I need to put props of them? – gskema Apr 27 '15 at 08:53
  • Alos, take a look at this (might help) http://lists.w3.org/Archives/Public/public-vocabs/2014Apr/0291.html#start291 – gskema Apr 27 '15 at 09:05
  • @gskema: It doesn’t matter if you use `html` or `body` or something else for your `itemscope`. The HTML5 hierarchy has no effect on the Microdata (it’s only relevant if you use Microdata properties to relate two items). So if you want to state some data about a webpage, use `WebPage`; if you want to state some data about a website, use `WebSite`; and if you want to state some data about both, use both. (Note that these don’t necessarily have to be about the current webpage/website, e.g., you could state something on *your* site about the `WebSite` with the `url` "`http://stackoverflow.com/`"). – unor May 01 '15 at 10:43
  • One final question (I hope you don't mind): is it ok to microdata about the same element in two different places (meaning that I declare it twice)? For example, declaring `WebSite` and then `potentialAction` somewhere and then `WebSite` again somewhere else (about the same Website). – gskema May 02 '15 at 19:14
  • @gskema: That is technically not forbidden, but [I’d recommend not to do it](http://stackoverflow.com/a/28632901/1591669). In case of Microdata, its [`itemref` attribute could be used in such a case](http://stackoverflow.com/a/28889281/1591669). – unor May 02 '15 at 22:01