Support Brand and Model schema.org attributes
[app-web-oof.git] / lib / App / Web / Oof.pm
index 0ecfd1be76bcf9761d07b2bbb9a3ca46ff533484..186fb2fc4e931df41d8b01ac51efa4ed90b8b99e 100644 (file)
@@ -74,12 +74,16 @@ sub make_slug {
 sub product_to_schemaorg {
        my ($include_url, %data) = @_;
        my $stock = $data{stock} > 0 ? 'InStock' : 'OutOfStock';
+       my @extra;
+       push @extra, (brand => {'@type' => 'Brand', name => $data{brand}}) if $data{brand};
+       push @extra, (model => $data{model}) if $data{model};
        +{
                '@context' => 'http://schema.org/',
                '@type'    => 'Product',
                name => $data{title},
                image => "/static/fullpics/$data{product}-1.jpg",
                description => $data{subtitle},
+               @extra,
                offers => {
                        '@type' => 'Offer',
                        price => ($data{price} =~ s/(..)$/\.$1/r),
This page took 0.010054 seconds and 4 git commands to generate.