= Microformats STILL IN DEVELOPMENT, IT SHOULD WORK, BUT USE AT YOUR OWN RISK! Created by Chris Powers, September 11, 2010 == Two Great Tastes, One Great Library The goal of this Microformats library is to give the developer a series of simple view helper methods to richly markup their HTML documents using both the older Microformats standard and the new HTML5 Microdata standard. By using microformats, you are opening your data up to Google and other consumers for easy and intelligent consumption. In the future, Google plans on making consumed microdata directly searchable, which yields all sorts of new potential for relevant results. == Installation Install the Microformats gem as usual: gem install microformats == Getting Started To use Microformats, first include the Microformats::Helper mixin into your view layer, like this in Rails: # in app/helpers/application_helper.rb module Application Helper include Microformats::Helpers end == Usage: vCards and Addresses You can easily markup a person and/or organization using the vcard helper method. This will use both the hCard Microformat and the http://www.data-vocabulary.org/Person microdata. PLEASE NOTE: These two microdata standards do not support the same fields. For example, hCard gives a person telephone numbers and email addresses. The Person microdata only gives organizations a single telephone number and has no support for email. vCards can embed addresses using the Microformats::Vcard#address method, which gives you a block to run with a new Microformats::Address object. EXAMPLE (using ERB): <% vcard do |card| %> <%= card.photo "/images/me.jpg", :size => '200x300' %> <%= card.name "John Doe" %> <%= card.url "Visit my Site", :href => "http://mydomain.com" %> <%= card.phone "999.888.7766", :type => 'Home' %> <%= card.phone "111.222.3344", :type => 'Work' %> <%= card.email "me@mydomain.com", :type => 'Home' %> I work at <%= card.company "Acme Co." %> <% card.address(:type => 'Work') do |adr| %> <%= adr.street "123 Main" %> <%= adr.city "Chicago" %>, <%= adr.state 'IL' %> <%= adr.zip '60010' %> <% end %> <%= card.download_link "http://mydomain.com" %> <% end %> This will output the following markup: