Join the Webstudio community

Updated 3 months ago

Having a problem with hygraph and encoded slug

At a glance

The community member created a blog using Hygraph and made some posts in Arabic. The generated slug looks fine in the 'inspect' view, but when checking the URL of the post's page and the slug variable, it's encoded (a bunch of symbols, numbers, and letters). This causes the query to return 'null' for each post that is not in English. The community members tried publishing the posts, which initially didn't work, but after re-doing the API Playground part and publishing again, it started working on the live site. However, the issue persists in the builder. The community members provided a sample text in Arabic ("ุงู„ุฏููˆุน ุงู„ุดูƒู„ูŠุฉ ููŠ ู†ุธุงู… ุงู„ู…ุฑุงูุนุงุช") and its slug ("ุงู„ุฏููˆุน-ุงู„ุดูƒู„ูŠุฉ-ููŠ-ู†ุธุงู…-ุงู„ู…ุฑุงูุนุงุช"), suggesting that the issue is related to how Hygraph handles URLs with non-Latin characters.

I made a blog using hygraph and made some posts in Arabic.
The generated slug looks fine in 'inspect' but when I check the url of the post's page and the slug variable it's encoded (a bunch of symbols, numbers, and letters). Now the query returns 'null' for each post which is not English. Any possible solution?
Attachments
IMG_20241126_1409341192.jpg
IMG_20241126_1406186932.jpg
J
A
9 comments
What are you entering in there that results in the encoded characters?
A generated slug (in Arabic) from hygraph. It looks fine outside the post page, like the links of the blog overview, but when I click a post the link gets encoded. The problem is that hygraph doesn't seem to accept the encoded slug as a variable so it returns null.
Curious, have you tried publishing and seeing if it works there?
It's one of the first things I did. At first it didn't work, I re-did the Api Playground part and published it again and it worked. Thank you!
Hm okay that's at least good. So it works on the live site and not the builder. Can you provide me a sample text that you are trying to use so I can create an issue to address this encoding in the builder?
Sure, the text is "ุงู„ุฏููˆุน ุงู„ุดูƒู„ูŠุฉ ููŠ ู†ุธุงู… ุงู„ู…ุฑุงูุนุงุช"
Slug becomes "ุงู„ุฏููˆุน-ุงู„ุดูƒู„ูŠุฉ-ููŠ-ู†ุธุงู…-ุงู„ู…ุฑุงูุนุงุช"
I think it's something to do with the way it handles the url when it contains non latin characters and not text specific.
I pasted this into the address bar and it's not getting encoded. What are the exact steps you are taking?
Attachment
image.png
And I tried binding it
Attachment
image.png
I was following your video about hygraph. Only difference is the language
Add a reply
Sign up and join the conversation on Discord