What is this property? What is it used for? How should it be set?
I understand what a slug is in general:
https://yoast.com/slug/
But what does it mean when it’s part of a Gallery? Is the gallery building URLs?
I need to programmatically manipulate Gallery items…
Q. What do I need to set for slug?
Q. Is slug required?
Q. What happens if you don’t set it? (ie, what functionality do you lose?)
Here are the API docs for the Wix Gallery API:
https://www.wix.com/corvid/reference/$w.Gallery.html
Specifically, ImageItem:
https://www.wix.com/corvid/reference/$w.Gallery.html#ImageItem
The documentation for slug is…less than helpful…
slug string Item slug.
The API docs for items():
https://www.wix.com/corvid/reference/$w.Gallery.html#items
Shows the following example of how to manipulate items in a gallery:
let items = $w ( “#myGallery” ). items ;
items . push ( {
“src” : “wix:image://v1/68d3a9_1de7529c444b4c9eb38401f8efe0cad2.jpg/flowers.jpg#originWidth=1970&originHeight=1120” ,
“description” : “Description” ,
“title” : “Title”
} );
$w ( “#myGallery” ). items = items ;
But this doesn’t show you how to set the slug property.
If you have a Media Gallery field in a Collection, the data stored in the field is a JSON blob of Array of ImageItem. A dump of my Wix Collection shows the JSON blob in the code snippet below. The slug is set to something that resembles the Wix filename (without the ~).
[
{
"description":"",
"slug":"c565a4_7e985bb77aa54cc2b121e60081056974mv2",
"src":"wix:image://v1/c565a4_7e985bb77aa54cc2b121e60081056974~mv2.jpg/0001_sjpg#originWidth=600&originHeight=400",
"title":"",
"type":"image",
"settings":[]
},
...
]
If I want to manipulate, and then re-save Media Gallery columns in my Collection, how do I set the slug?