semantic-blocks
v0.0.3
Published
Easily add Schema.org to your BEM-project
Downloads
8
Maintainers
Readme
semantic-blocks
Easily add Schema.org to your BEM-project.
Install
Just install it as npm package:
npm install bh
Add level node_modules/semantic-blocks/schema
to your BEM/ENB make file, and add i-bem__schema
to deps:
({
mustDeps: {
block: 'i-bem',
elem: 'schema'
}
});
Usage
itemtype
Add any available schema to any block or element:
bh.match('my-blog__post', function(ctx) {
ctx.itemtype('Article');
});
yields
<div class="my-blog__post" itemscope itemtype="http://schema.org/Article"></div>
itemprop
Add any itemprop available for your scheme to any block or element:
bh.match('quote__author', function(ctx) {
ctx.itemprop('author');
});
yields
<div class="quote__author" itemprop="author"></div>
Predefined blocks
Now there is only one block which has schema.org properties: article. So, if you call your block article
, it will get an itemtype= http://schema.org/Article
.
Other blocks are comming soon. Send me pull-request with blocks you need, or open an issue.