Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

schema.org and an online dictionary

Tags:

schema.org

I'm having trouble about what to use from schema.org. I'm making a web site kinda similar to urbandictionary.com. Users are the contributors of the dictionary. Also the dictionary may include phrases like "2012 London Olympics", "MIT Dorms" etc. Whatever. So I want to add schema to the website. What should be schema-named the words/phrases and the users' descriptions?

http://schema.org/docs/full.html

Edit: layout of a sample page:

Gmail

  1. Google's email service -user63
  2. best email service in terms of spam prevention -user21
  3. Gmail has a support of IMAP, POP3, SMTPi OAUTH, FRD, two-way secure login -userMew

Edit2: loyout of another sample page:

Batman 5

  1. Upcoming movie of Batman, where Justien Bieber is going to play Joker -user43, May 2015
  2. The opening was a disaster; Bieber slipped to the stairs and then was carried to a hospital -user22, December 2015
  3. This movie was a disaster, a very poor quality movie -userKitten, March 2016
like image 733
ilhan Avatar asked Feb 20 '23 17:02

ilhan


1 Answers

General

There is a getting started page in the documentation on schema.org. As you are building a dictionary, you might have an entry about a movie there (the example they are using). The markup could look like this:

<div itemscope itemtype ="http://schema.org/Movie">
  <h1 itemprop="name">Avatar</h1>
  <span>Director: <span itemprop="director">James Cameron</span></span>
  <span itemprop="genre">Science fiction</span>
  <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a>
</div>

This requires that you know that your data entry is a movie of course. If you do not know that, you could use the itemtype Article (or even Thing) and the global properties name and description.

There is also additional information about the format of e.g. dates and how to integrate invisible data using the meta tag and setting a content attribute: <meta itemprop="bestRating" content="5" />.

You can always give multiple types to an item by specifying the property additionalType. You can even extend the schema. But you should use them carefully as they are not recognized by search engines, but might get used in the future:

If the schema gains adoption and proves useful to search applications, search engines may start using this data.

In general, all this markup is optional, so feel free to mark up as much as possible, but only those parts that make sense. From the schema.org FAQ:

It is fine to mark up only some properties of an item - markup is not an all-or-nothing choice.

Markup validation

To test your markup, Google provides a Rich Snippets Testing Tool. You can paste your HTML there and see what Google extracts from it. For the above example, this is the result:

Item
    Type: http://schema.org/movie
    name = Avatar
    director = James Cameron
    genre = Science fiction
    trailer
    text = Trailer
    href = http://www.example.com/movies/avatar-theatrical-trailer.html

On your page

As the information on your page is user-generated, you could let the users choose from the higher level schema.org types (Movie, Place (MIT Dorms), SportsEvent (2012 London Olympics) etc.) and fallback to Thing. Then get the data in form elements matching the properties of those types. Save the data and evaluate it when you build your dictionary pages. It is then crawled by Google (and others) and used for indexing.

For the Gmail example you gave, the markup could simply look like this (copy and paste it into the testing tool to see that Google understands the nesting):

<div itemscope itemtype ="http://www.schema.org/SoftwareApplication">
  <h1 itemprop="name">Gmail</h1>
  <div itemprop="comment" itemscope itemtype="http://www.schema.org/Comment">
    <span itemprop="comment">Google's email service</span>
    <span itemprop="author">user63</span>
  </div>
  <div itemprop="comment" itemscope itemtype="http://www.schema.org/Comment">
    <span itemprop="comment">best email service in terms of spam prevention</span>
    <span itemprop="author">user21</span>
  </div>
  <div itemprop="comment" itemscope itemtype="http://www.schema.org/Comment">
    <span itemprop="comment">Gmail has a support of IMAP, POP3, SMTPi OAUTH, FRD, two-way secure login</span>
    <span itemprop="author">userMew</span>
  </div>
</div>

Additional information

For more information see the Google schema.org FAQs. Also see the Dublin Core Metadata Initiatice (DCMI) (Wikipedia) as an alternative way to semantically markup your data. They also have a wiki page for mapping between schema.org and DC.

like image 179
Wolfram Avatar answered Mar 19 '23 04:03

Wolfram