Announcement

Collapse
No announcement yet.

JSON-LD on Product pages...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    JSON-LD on Product pages...

    Afternoon all, we would like to utilize JSON-LD for a schema.org markup if possible. I know that microdata can be processed by wrapping the tags in schema-specific terminology. My question is, has anyone successfully implemented a JSON-LD markup? JSON-LD is separate from the HTML markup, which is nice; however, it is within a script call, IE:

    Code:
    <script type="application/ld+json">
    {
      "@context": {
        "gr": "http://purl.org/goodrelations/v1#",
        "pto": "http://www.productontology.org/id/",
        "foaf": "http://xmlns.com/foaf/0.1/",
        "xsd": "http://www.w3.org/2001/XMLSchema#",
        "foaf:page": {
          "@type": "@id"
        },
        "gr:acceptedPaymentMethods": {
          "@type": "@id"
        },
        "gr:hasBusinessFunction": {
          "@type": "@id"
        },
        "gr:hasCurrencyValue": {
          "@type": "xsd:float"
        }
      },
      "@id": "http://example.org/cars/for-sale#tesla",
      "@type": "gr:Offering",
      "gr:name": "Used Tesla Roadster",
      "gr:description": "Need to sell fast and furiously",
      "gr:hasBusinessFunction": "gr:Sell",
      "gr:acceptedPaymentMethods": "gr:Cash",
      "gr:hasPriceSpecification": {
        "gr:hasCurrencyValue": "85000",
        "gr:hasCurrency": "USD"
      },
      "gr:includes": {
        "@type": [
          "gr:Individual",
          "pto:Vehicle"
        ],
        "gr:name": "Tesla Roadster",
        "foaf:page": "http://www.teslamotors.com/roadster"
      }
    }
    </script>
    Because of this, I’m not sure how to ‘grab’ the dynamic variables (IE: &mvt:product:name;) from within the script. Any one figured out how to do this?

    #2
    Not sure if you're still looking for an answer on this. You can just insert the Miva variable inside the script. For example:

    This code is using the Sebenza Ultimate Reviews Module for those variables, as well as a custom product field for brand, but you can adjust as needed.

    Code:
    <!-- Google Structured Data -->
    <script type="application/ld+json">
    {
      "@context": "http://schema.org/",
      "@type": "Product",
      "name": "&mvt:product:name;",
      "image": [
        "https://www.domain.com&mvt:global:imageroot;&mvte:global:ipath;"
       ],
      "description": "&mvt:product:descrip;",
      "mpn": "&mvta:product:code;",
      "brand": {
        "@type": "Thing",
        "name": "&mvt:product:customfield_values:customfields:brand;"
      },
      "aggregateRating": {
        "@type": "AggregateRating",
        "ratingValue": "&mvt:global:rating;",
        "reviewCount": "&mvt:global:Total_Reviews;"
      },
      "offers": {
        "@type": "Offer",
        "priceCurrency": "USD",
        "price": "&mvt:product:price;",
        "itemCondition": "http://schema.org/NewCondition",
        "availability": "http://schema.org/InStock",
        "seller": {
          "@type": "Organization",
          "name": "Your Company Name"
        }
      }
    }
    </script>
    Joe McDonald
    patrickwebby.com

    Comment


      #3
      I wonder why this isn't the default coding used in the newer ReadyThemes?
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        lesliekirk
        Shadows is currently being reworked and this is something being considered.
        Matt Zimmermann

        Miva Web Developer
        Alchemy Web Development
        https://www.alchemywebdev.com
        Site Development - Maintenance - Consultation

        Miva Certified Developer
        Miva Professional Developer

        https://www.dev4web.net | Twitter

        Comment


          #5
          Well, for one thing, the type and scope of data is VERY site dependent. A script-less approach would require a pretty hefty interface to support. I.e., show reviews?, business type?, product condition? There are literally hundreds of options for micro-data markup. You could perhaps support the majority (using custom fields?) but you'd sill need to be able to 'open it up' to cover a specific business's needs.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            Bruce - PhosphorMedia Very true. That's the issue with the current microdata implementation as well. Ultimately, there would be a section in the administration portal which would handle all the bits and bobs and produce the output. The other side of it is setting what is global and what is page or product specific.
            Matt Zimmermann

            Miva Web Developer
            Alchemy Web Development
            https://www.alchemywebdev.com
            Site Development - Maintenance - Consultation

            Miva Certified Developer
            Miva Professional Developer

            https://www.dev4web.net | Twitter

            Comment

            Working...
            X