Using something like
%div{:itemscope => true}
is the right way to specify this in your Haml file.
How this works out depends on how you set the Haml format parameter. By default, Haml 3.1 has xhtml , and with that it will display as itemprop='itemprop' , which is a valid xhtml. For rendering with minimal attributes (e.g. <div itemscope> ) you need to set html4 or html5 format. (Rails 3 uses html5 by default, and Haml 4.0 uses html5 by default.)
How to set Haml parameters depends on how you use it, see the parameters section in the docs .
For example, using Haml directly in Ruby, this is:
engine = Haml::Engine.new '%div{:itemscope => true}' puts engine.render
creates xhtml by default with full attributes:
<div itemscope='itemscope'></div>
But this:
engine = Haml::Engine.new '%div{:itemscope => true}', :format => :html5 puts engine.render
creates the desired result with minimized attributes:
<div itemscope></div>
matt Jun 06 2018-11-11T00: 00Z
source share