Skip to content

Instantly share code, notes, and snippets.

@steveosoule
Last active November 21, 2019 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save steveosoule/0f5cfe27de968c9baa4d18142d86d721 to your computer and use it in GitHub Desktop.
Save steveosoule/0f5cfe27de968c9baa4d18142d86d721 to your computer and use it in GitHub Desktop.
PROD microdata itteration
<mvt:item name="html_profile"/>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="&mvt:global:basehref;">
<mvt:if expr="NOT ISNULL l.settings:product:page_title">
<title>&mvt:product:page_title;</title>
<mvt:elseif expr="NOT ISNULL l.settings:page:title">
<title>&mvt:page:title;</title>
<mvt:else>
<title>&mvt:store:name;: &mvt:product:name;</title>
</mvt:if>
<mvt:item name="head" param="css_list" />
<mvt:item name="head" param="head_tag" />
<mvt:item name="attributemachine" param="head_deferred" />
<mvt:item name="product_display_imagemachine" param="head_deferred" />
<mvt:assign name="g.socialURL" value="l.settings:product:link" />
<mvt:assign name="g.socialText" value="'Check out the deal on ' $ l.settings:product:name $ ' at ' $ g.store:name" />
<mvt:do file="g.Module_Library_DB" name="l.success" value="ImageType_Load_Code('main', l.settings:imagetype)" />
<mvt:do name="l.success" file="g.Module_Library_DB" value="ProductImage_Load_Type(l.settings:product:id, 1, l.settings:imagetype)" />
<mvt:do name="l.success" file="g.Module_Library_DB" value="Image_Load_ID(l.settings:imagetype:image_id, l.settings:imagedata)" />
<mvt:assign name="g.socialImage" value="g.baseurl $ l.settings:imagedata:image" />
<meta property="og:title" content="&mvte:product:name;">
<meta property="og:type" content="product">
<meta property="og:image" content="&mvt:global:socialImage;">
<meta property="og:url" content="&mvt:global:socialURL;">
<meta property="og:site_name" content="&mvte:global:store:name;">
<meta property="og:description" content="&mvte:global:socialText;">
<meta property="og:locale" content="en_US">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@TWITTER_ACCOUNT">
<meta name="twitter:creator" content="@TWITTER_ACCOUNT">
<meta name="twitter:url" content="&mvt:global:socialURL;">
<meta name="twitter:title" content="&mvte:product:name;">
<meta name="twitter:description" content="&mvte:global:socialText;">
<meta name="twitter:image" content="&mvt:global:socialImage;">
<meta name="twitter:image:alt" content="&mvte:product:name;">
</head>
<body id="js-&mvte:page:code;" class="o-site-wrapper t-page-&mvt:global:pageClass;">
<mvt:item name="hdft" param="global_header" />
<section class="o-layout">
<div class="o-layout__item">
<mvt:item name="hdft" param="header" />
</div>
</section>
<section class="o-layout">
<div class="o-layout__item">
<mvt:item name="prod_ctgy_hdft" param="prod_header" />
</div>
</section>
<!-- Start: Google Rich Snippets -->
<mvt:comment>Strip any HTML from the product description.</mvt:comment>
<mvt:assign name="l.settings:product:stripped_descrip" value="miva_html_strip(l.settings:product:descrip, '')"/>
<div itemscope itemtype="http://schema.org/Product">
<meta itemprop="name" content="&mvte:product:name;" />
<meta itemprop="image" content="&mvt:global:socialImage;" />
<meta itemprop="category" content="&mvte:category:name;" />
<meta itemprop="description" content="&mvte:product:stripped_descrip;" />
<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields:brand">
<meta itemprop="brand" content="&mvte:product:customfield_values:customfields:brand;" />
</mvt:if>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<mvt:if expr="NOT ISNULL l.settings:product:sku">
<meta itemprop="sku" content="&mvte:product:sku;" />
<mvt:else>
<meta itemprop="sku" content="&mvte:product:code;" />
</mvt:if>
<mvt:comment>
!important!
Need to make sure itemprop=price is removed from `item => product_display`
</mvt:comment>
<mvt:item name="product_display" />
<mvt:item name="attributemachine" param="body_deferred" />
<script>
if (typeof am&mvt:product:id; !== 'undefined') {
var attrMachCall = am&mvt:product:id;,
attrPossible = amPossible&mvt:product:id;;
};
</script>
<mvt:assign name="l.settings:product:itempropurl" value="l.settings:product:link" />
<mvt:comment>
store.com/someproduct?variant_id={id}
</mvt:comment>
<mvt:if expr="g.variant_id GT 0">
<mvt:assign name="l.settings:product:itempropurl" value="l.settings:product:itempropurl$'?variant_id='$g.variant_id" />
</mvt:if>
<meta itemprop="url" content="&mvte:product:itempropurl;">
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="seller" content="&mvte:global:store:name;" />
<meta itemprop="itemCondition" content="new" />
<mvt:comment>
intemprop:price - default
</mvt:comment>
<mvt:assign name="l.settings:product:itemprop_price" value="l.settings:product:price" />
<mvt:comment>
intemprop:price - when a variant is available
</mvt:comment>
<mvt:if expr="l.settings:attributemachine:variant_id GT 0">
<mvt:assign name="l.settings:product:itemprop_price" value="l.settings:attributemachine:product:price" />
</mvt:if>
<mvt:if expr="l.settings:attributemachine:product:inv_level">
<mvt:assign name="l.settings:itemprop_price" value="l.settings:attributemachine:product:price" />
<mvt:assign name="l.availability_inv_level" value="l.settings:attributemachine:product:inv_level"/>
<mvt:do name="l.formatted_variant_price" file="g.Module_Root $ g.Store:currncy_mod:module" value="CurrencyModule_AddFormatting( g.Store:currncy_mod, l.settings:attributemachine:product:price )" />
<mvt:else>
<mvt:assign name="l.availability_inv_level" value="l.settings:product:inv_level"/>
</mvt:if>
<mvt:comment>
Inventory Levels
- https://schema.org/ItemAvailability
</mvt:comment>
<mvt:if expr="l.availability_inv_level EQ 'low'">
<meta itemprop="availability" content="LimitedAvailability"/>
<mvt:elseif expr="l.availability_inv_level EQ 'out'">
<meta itemprop="availability" content="OutOfStock"/>
<mvt:else>
<meta itemprop="availability" content="InStock"/>
</mvt:if>
<meta itemprop="price" content="&mvt:product:itemprop_price;"/>
</div>
</div>
<!-- End: Google Rich Snippets -->
<mvt:if expr="l.settings:related_product_count NE 0">
<mvt:item name="related_products" />
</mvt:if>
<section class="o-layout">
<div class="o-layout__item">
<mvt:item name="prod_ctgy_hdft" param="prod_footer" />
</div>
</section>
<section class="o-layout">
<div class="o-layout__item">
<mvt:item name="hdft" param="footer" />
</div>
</section>
<mvt:item name="hdft" param="global_footer" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment