markhuge

Review Microformat

Published by Mark on

A shortcode implementation of h-review that I use on this site.

Shortcode template:

<div class="h-review">
  <p>
  <a class="p-item h-item" href="{{.Get `url`}}">
    <span class="p-name">{{.Get "title"}}</span>
  </a>
  <data class="p-rating" value="{{.Get `rating`}}">{{ "β˜…" | strings.Repeat (.Get "rating") }}</data>
  </p>

  <div class="e-content">
    {{.Inner}}
  </div>
</div>

Usage:

{{% review title="A thing" url="https://a.thing" rating="3" %}}
  The thing was ok.
{{% /review %}}

Output:

A thing β˜…β˜…β˜…

The thing was ok.