Join the Webstudio community

Updated 8 months ago

Troubleshooting a headless cms blog with hygraph

At a glance

The community member created a blog using Hygraph, but the blog is not showing up on their website. Other community members try to help by suggesting troubleshooting steps, such as checking the published URL, using the correct token, and verifying the query. They also share links to a video tutorial and documentation. The community members discuss changes in the templates over time and provide suggestions on how to set up the project correctly. Eventually, they identify an issue with the query and provide a sample query that should work. The community member plans to set up the blog again and double-check the code.

Useful resources
Can I pick peoples brains on the headless cms? I followed the tutorial John did with creating the blog with Hygraph. I've just created a blog in hygraph and published it but it's not showing up in my website. Any ideas where I should be looking at to troubleshoot?
O
J
J
45 comments
how can we know without seeing anything?
That is a very good point, heres a short screen vid https://www.tella.tv/video/josefas-video-22b1
share link to the builder and the published site
since its working in the builder I think you are not accessing the right url on the published site
I fogot you can do this with webstudio lol
published versin too
I'm not sure what you mean? Can you send a screenshot?
Do you mean this?
so what's the problem?
that url shows everything correctly
No it doesnt show the latest blog I published in hygraph
these are the 3 published blog posts, my page shows 2 of them and not the latest one
Attachment
Screenshot_2024-06-22_at_2.35.11_AM.png
did you use your token ? is it rendering from your hygraph account?
e.g. if you change any existing item that renders, does the change show up?
is this yours? or still our template
It would be from the template
well how did you follow the video?
I am confused, this is the first thing that every video does
how would your project know you want to fetch data from your hygraph account
;ll revist the video. But youve got JOhn creating from scratch and yet the templates we use have already been reformatted
templates improve over time
changes are inevitable
basics are the same though
nothing fundamentally different
not disagreeing with that but I thought i was following along apparently not
i havent followed this thread but saw you mentioned things have changed. i documented those changes here fyi https://docs.webstudio.is/university/integrations/hygraph#pagination
Thanks John for sharing this, I'm having a bit of trouble understanding where those changes take place. Is this where I'm supposed to be looking? https://www.tella.tv/video/josefas-video-6hpu
Also, as I realise this isn't your job to teach me headless CMS, if you could point me towards videos or places to learn this that would be great.
Also another discrepency I am noticing is that when I make these changes to the binding values, the automated slug thats generated in the variables table is of a blog post that I deleted.
Attachment
Screenshot_2024-06-22_at_9.33.59_AM.png
That "automated slug" is a preview value entered in the address bar. The values will stay in the history even if the post was deleted (in the future there will be a way to remove them) https://docs.webstudio.is/university/foundations/cms#address-bar
Ok, that makes sense
also the original walkthrough still works great. the change i made to the template is if you need pagination then the query changes
Ok, I'm going to rewatch it again, I'm clearly missing something. I'm just noticing that even though I update the code the new blog content doesn't migrate to my webpage. But I'll keep playing around with it.
something i noticed in your query... it's not accepting the variable slug properly. roughly it should look like this

Plain Text
query MyQuery($slug: String = "") {
  post(where: {slug: $slug})
}
where yours is

Plain Text
query MyQuery {
  post(where: {slug: "$"})
}
Ok, thanks I'll take a look at that I just deleted my blog
Im going to set it up again and double check the code with this code
sounds good. if you dont want to mess with it at all then the template is the marketplace is ready to go. you just need to swap out the urls and its working
Awesome apprecaite it thanks John!
Add a reply
Sign up and join the conversation on Discord