Hello,
I search to fix an problem.
I have a database, and I want to use this informations for complete shema. org, smartly.
In my exemple, I want to pass the value “note”
import wixData from 'wix-data';
import wixLocation from 'wix-location';
import wixSeo from 'wix-seo';
import {local} from 'wix-storage';
var url = wixLocation.baseUrl + wixLocation.path
wixData.query("Portail")
.eq("url", url ) // Url is use for find the good line.
.find()
.then((results) => {
var result = results.items[0];
local.setItem("note", result.note);// I use an local, because I can't obtain the value outside of .then
})
var note = local.getItem("note");
console.log(note); // Ok, I get It ! He say : 2,5
wixSeo.setStructuredData(
[ {
"@context": "http://schema. org",
// [...] The code is bigger, note is just the crash test.
"AggregateRating": {
"@type": "AggregateRating",
"ratingValue": note,
"ratingCount": "1",
"reviewCount": "1"
}
Apparently, no problem with the code.
But, when I test the rich result of Google, the field is empty !
On another side, if I mark directly : var note = “2,5” He pass the test… The var url pass also…
I try with async/await, anothers var in the database, stringify, … without succes.
Please, master, what is this boolshit ?