Hi Sebastian,
I think I’m going to need your help with this one. I’ve checked both the forums and docs.squidex.io but couldn’t find much info.
The problem is that I’m populating my index at Algolia but the JSON sent over from Squidex seems broken. Here are the reproduce steps:
-
Set up your schemas, rules, etc so that you have a working Algolia integration.
-
Make sure you have a
body
field in your schema (see screenshot)
-
Add the Liquid script:
{
"title": "{{event.data.title.en-US}}",
"description": "{{event.data.description.en-US}}",
"body": "{{event.data.body.en-US | html2text}}",
"author": "{{event.data.author.iv}}",
"authorRole": "{{event.data.authorRole.en-US}}",
"publishedDateTimestamp": "{{event.data.publishedDateTimestamp.iv}}"
}
- Update your
body
field content with:
<p class="lead">
Until now, trying to style an article, document, or blog post with
Tailwind has been a tedious task that required a keen eye for
</p>
and then check your Algolia index; you will see the following error message there:
"Invalid JSON: '0x0A' is invalid within a JSON string. The string should be correctly escaped. Path: $.body | LineNumber: 3 | BytePositionInLine: 79."
According to ChatGTP:
The character
0x0A
is a newline character in hexadecimal notation. In JSON, newline characters within strings must be properly escaped.
The newline character that the Algolia error message is referring to is the character between “with” and “Tailwind” in the HTML markup above.
In the meantime I could create a new plain text (no markup) body field and index that but then I would need to maintain two fields for each blog post which is not ideal. Is there a better work-around in the mean time?
Thanks!