DEV Community

Discussion on: Headless WordPress with Sapper (Part 1)

Collapse
 
anilbhattaraitoronto profile image
Anil Bhattarai

Thank you for your reply. I have not tried the permalink with post-name yet, but i am hesitant to use that because there might be posts with same title which might end up creating same post-names and, therefore, maybe conflict with querying. Not sure. I will soon try things out and see how they go.

Thread Thread
 
shriji profile image
Shriji

Thanks, I think permalinks will create unique slugs.

Pls try and let me know. I am glad you find this post helpful.

Thread Thread
 
anilbhattaraitoronto profile image
Anil Bhattarai

I could get the request on the browser but not through the sapper page.

Thread Thread
 
shriji profile image
Shriji

That's odd, what seems to be the error?

Thread Thread
 
anilbhattaraitoronto profile image
Anil Bhattarai

I saw that the json that I received was an array, not a single object. Therefore, I did iterate for arr[0] to get that single object.

Thread Thread
 
anilbhattaraitoronto profile image
Anil Bhattarai

In the [slug] page I did this: return { post: data[0] };

Thread Thread
 
shriji profile image
Shriji

Yes that is right, I have covered it in the next post there are 5 parts right now.

Also I have pushed my repo github.com/peopledrivemecrazy/Sapp...