Giter Site home page Giter Site logo

onhate / schemorger Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 6.0 628 KB

SchemOrger is a Java Library for generating schema.org hidden html snippets for SEO and Rich Snippets. It will generate hidden schema.org metatags for your page.

License: Apache License 2.0

Java 100.00%
seo seo-optimization schema-org meta-tags java rich-snippets schema

schemorger's Introduction

schemorger (beta)

SchemOrger is a Java Library for generating schema.org hidden html snippets for SEO and Rich Snippets. It will generate hidden schema.org metatags for your page.

It's really simple to use, like this:

Product product = new Product();
product.setName("simple product schemorger");

// rating
AggregateRating aggregateRating = new AggregateRating();
aggregateRating.setBestRating(5);
aggregateRating.setWorstRating(1);
aggregateRating.setRatingValue("4.5");
aggregateRating.setReviewCount(42.0);
product.setAggregateRating(aggregateRating);

// sku
product.setSku("42");

// releaseDate
product.setReleaseDate(new Date());

// brand
Brand brand = new Brand();
brand.setName("Texelz");
brand.setUrl(Link.toWiki("Texelz"));
brand.setLogo(Link.to("http://placehold.it/300&text=schemorger"));
product.setBrand(brand);

// url
product.setUrl(Link.to("http://www.texelz.com/schemorger"));

// image
product.setImage(Link.to("http://placehold.it/300&text=schemorger+product"));

// Offer
Offer offer = new Offer();
offer.setPrice(55.00);
ItemAvailability availability = new ItemAvailability();
availability.setUrl(Link.toSchema(Constants.InStock));
offer.setAvailability(availability);
product.setOffers(offer);

StringBuilder result = SchemaOrgBuilder.build(product);

and voilá, just place it on your page, Check the RichSnippet Test Tool result

<div itemscope itemtype="http://schema.org/Product">
	<meta itemprop="releaseDate" content="2014-04-06T17:19"/>
	<meta itemprop="name" content="simple product schemorger"/>
	<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
		<meta itemprop="price" content="55.0"/>
		<link itemprop="availability" href="http://schema.org/InStock"/>
	</div>
	<div itemprop="brand" itemscope itemtype="http://schema.org/Brand">
		<link itemprop="logo" href="http://placehold.it/300&text=schemorger"/>
		<meta itemprop="name" content="Texelz"/>
		<link itemprop="url" href="http://pt.wikipedia.org/wiki/Texelz"/>
	</div>
	<link itemprop="image" href="http://placehold.it/300&text=schemorger+product"/>
	<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
		<meta itemprop="ratingValue" content="4.5"/>
		<meta itemprop="reviewCount" content="42"/>
	</div>
	<meta itemprop="sku" content="42"/>
	<link itemprop="url" href="http://www.texelz.com/schemorger"/>
</div>

All objects in package org.schema are based on schema.org schemas

P.S.:

It's still in development

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.