Dealing with an issue and thought I would reach out here first just in case someone can help.
I have created a image slider as a custom module using Alpinejs for the functionality. Each image is group with a rich text field. The slider functions as it should, however, dumping the rich text field into my Alpinejs array is causing a syntax error. I am not sure how to resolve it.
Here is the code. As you can see, I am putting the rich text field contents into the caption object using the module hubl tag from the image group.
<div class="w-full max-w-6xl mx-auto relative"
x-data="{
selected: 0,
images: [
{
src: '{{ module.image1_group.image1.src }}',
alt: '{{ module.image1_group.image1.alt }}',
caption: '{{ module.image1_group.rich_text1 }}'
},
{
src: '{{ module.image2_group.image2.src }}',
alt: '{{ module.image2_group.image2.alt }}',
caption: 'Sample text2 goes here'
},
{
src: '{{ module.image3_group.image3.src }}',
alt: '{{ module.image3_group.image3.alt }}',
caption: 'Sample text3 goes here'
},
{
src: '{{ module.image4_group.image4.src }}',
alt: '{{ module.image4_group.image4.alt }}',
caption: 'Sample text4 goes here'
},
{
src: '{{ module.image5_group.image5.src }}',
alt: '{{ module.image5_group.image5.alt }}',
caption: 'Sample text5 goes here'
},
{
src: '{{ module.image6_group.image6.src }}',
alt: '{{ module.image6_group.image6.alt }}',
caption: 'Sample text6 goes here'
},
]
}">
As is, it’s causing the Alpinejs syntax error. If I manually type the html in, it works fine. Hubspot must be including some syntax and/or characters that Alpine doesn’t like and that I can’t see.
Any ideas on how I might be able to resolve this?
Thanks,
Terry McMillan
