Programmatic structured data with Wix Velo: dynamic JSON-LD from database fields
Module 66: Wix Velo & Dev Mode: Advanced SEO for Developers | Lesson 676 of 688 | 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
- Product schema for Wix Stores product pages — enables price, availability, and review rich results
- Article schema for Wix Blog posts — include author, datePublished, and dateModified
- Service schema for service listing dynamic pages — include serviceType, provider, and areaServed
- LocalBusiness schema for location pages — include address, geo coordinates, and opening hours
- Recipe schema for food and cooking sites using recipe database collections
- Event schema for Wix Events app dynamic event pages
Testing and Validating Dynamic Structured Data
Validation workflow for Velo-injected structured data
- Publish your Velo changes to the live site (structured data injection does not work in preview mode).
- Navigate to a live dynamic page on your Wix site.
- Open Google's Rich Results Test at search.google.com/test/rich-results.
- Enter the full URL of your dynamic page and run the test.
- Confirm that the correct schema type is detected and that all required properties are present.
- Test three to five different items from your collection to ensure the dynamic data is populating correctly for each.
- Check the Coverage > Rich Results section in Google Search Console after 48 hours to see if rich results are being detected site-wide.
How to Generate JSON-LD Schema Programmatically with Wix Velo
Programmatic schema generation with Velo ensures every dynamic page on your Wix site has accurate, item-specific structured data rather than static or empty schema.
Complete implementation guide for programmatic JSON-LD injection using Wix Velo on dynamic pages
- Open the Wix Editor with Dev Mode enabled and navigate to the dynamic page that requires programmatic schema.
- Open the page code file from the Velo sidebar and add import statements at the top: import wixData from 'wix-data'; and import { setStructuredData } from 'wix-seo';
- Inside the $w.onReady function, call const item = await wixData.getCurrentItem(); to load the current page's collection data.
- Create a JavaScript object representing the JSON-LD schema, using item fields to populate the required properties dynamically.
- For a Product page, include "@type": "Product", "name": item.title, "description": item.description, and "offers" with item.price and availability.
- Wrap all optional fields in conditional checks using item.fieldName !== undefined before including them to prevent validation errors from missing data.
- Call setStructuredData([schemaObject]); to inject the completed schema into the page head.
- Wrap the entire schema creation and injection in a try-catch block to prevent any errors from breaking the page.
- Publish the changes to the live site — structured data injection only works correctly on the published live version, not in editor preview.
- Open Google's Rich Results Test at search.google.com/test/rich-results and test the URL of three different items from your collection.
- Confirm that the correct schema type is detected for each item with accurate, item-specific data in the properties.
- After 48 hours, check Google Search Console > Enhancements to see if the new schema type is being detected across your collection.
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.