FAQ Multistate from Collection - How to inject FAQ Structured Data?

Hi all

After pulling my hair out with the FAQ app, I’m experimenting with using a ‘Multistate’ box connected to a FAQ Collection to achieve the same results, so I have a simple Multistate box with an Close (Question) and Open (Answer) state using the following Velo code:

$w.onReady(function () {

$w('#plusIcon1').onClick(() => {
	$w('#stateBox1').changeState("open1");

})

$w('#minusIcon1').onClick(() => {
	$w('#stateBox1').changeState("close1");

})

});

And this works and does the job successfully.

What I’d now like to know is how would I add code to ensure each page has dynamically inject structured data for each FAQ?

If it anyone could advise it would be greatly appreciated.

Many thanks

Stephen

(unfortunately this silly discussion system won’t let me add more than one image/screens shot so I’ve added the answer part screenshot in the reply below).

Product:
Wix Studio

What are you trying to achieve:
A FAQ connected to a FAQ Collection that auto-appends dynamically inject structured FAQ data for SEO purposes

What have you already tried:
Successfully integrating a FAQ to a FAQ Collection and using a Multistate box to use an Open and Close answer format.

Additional information:
[Include any other pertinent details or information that might be helpful for people to know when trying to answer your question.]

Before you pull your hair out —- let’s take a look at what you have!

First, I think you are building in a regular page but you intend to create a custom FAQ in multiple pages, yes?

Second, you want the FAQ data to “auto-fill” in a matter of speaking, yes?

What you need to do is create one database will, question, answer, page.

Then you will add a repeater to the page. The repeater will have a box with the question and open icon, and a second box with answer and close icon. Set both boxes to collapse. You will connect the repeater via a dataset set with a filter.

Then you can add a code so the repeater items can open and close.

Repeat as needed on other pages.

I can’t remember if I have a tutorial on this but if I find it I will share the link.

Hi, apologies for the delay in replying only for some reason Ive only just seen your response.

The issue is not how to create the FAQs via collections, as this is relatively easy, the issue is "…how would I add code to ensure each page has dynamically inject structured data for each FAQ? :slightly_smiling_face: