Programmatic structured data with Wix Velo: dynamic JSON-LD from database fields

Module 66: Wix Velo & Dev Mode: Advanced SEO for Developers | Lesson 675 of 687 | 36 min read

By Michael Andrews, Wix SEO Expert UK

Wix's standard SEO tools allow you to add structured data to static pages through the JSON-LD field in Advanced SEO settings. But for dynamic pages — product pages, service listings, blog posts, directory entries — the structured data needs to be dynamic too, populated with the actual data from each specific page. Wix Velo makes this possible, allowing you to programmatically generate and inject accurate, item-specific JSON-LD structured data for every dynamic page on your site.

Why Dynamic Structured Data Matters

A static JSON-LD block on a dynamic page will contain the same data for every item. This means if you have a product page template with static Product schema, every product's structured data will show the same name, price, and description — usually whatever was in the template at the time you created it. This is not only useless for Google Rich Results, it can actively mislead search engines and result in your structured data being ignored or flagged as inconsistent.

Injecting JSON-LD with Velo's wix-seo setStructuredData Function

// Dynamic page code for Wix product page
// This injects accurate Product schema for each item
import wixData from 'wix-data';
import { setStructuredData } from 'wix-seo';

$w.onReady(async function () {
  const item = await wixData.getCurrentItem();

  if (item) {
    const productSchema = {
      "@context": "https://schema.org",
      "@type": "Product",
      "name": item.title,
      "description": item.description,
      "image": item.mainImage,
      "brand": {
        "@type": "Brand",
        "name": "Your Brand Name"
      },
      "offers": {
        "@type": "Offer",
        "price": item.price.toString(),
        "priceCurrency": "GBP",
        "availability": item.inStock
          ? "https://schema.org/InStock"
          : "https://schema.org/OutOfStock",
        "url": `https://yoursite.com/products/${item.slug}`
      }
    };

    setStructuredData([productSchema]);
  }
});

Schema Types to Prioritise for Dynamic Wix Pages

Testing and Validating Dynamic Structured Data

Validation workflow for Velo-injected structured data

Error Handling: Always wrap your Velo structured data injection in a try-catch block. If a collection item has a missing field that your schema references, the error will prevent the entire schema from being injected. Use conditional checks (if item.price !== undefined) before including optional fields in your JSON-LD object to ensure the schema always validates correctly.

This lesson on Programmatic structured data with Wix Velo: dynamic JSON-LD from database fields is part of Module 66: Wix Velo & Dev Mode: Advanced SEO for Developers in The Most Comprehensive Complete Wix SEO Course in the World (2026 Edition). Created by Michael Andrews, the UK's No.1 Wix SEO Expert with 14 years of hands-on experience, 750+ completed Wix SEO projects and 425+ verified five-star reviews.