Closed dominicmichaud closed 5 years ago
If you are running the http://localhost:1337/posts
request with Postman fir example, did you have data or a 404 error ?
Same error here following the blog instructions and code from the github repo.
Looking at the logs the Strapi API is getting a 404 because it attempts to fetch /post
which does not exist. The trick is to update to /posts
in Jekyll _config.yml
.
Then another templating error arise
Liquid Exception: Can't convert Integer into String. in /_layouts/home.html
Please can you answer to my question with Postman it will help me to understand the issue.
Sorry I dont use Postman but wget or curl works just fine. /posts
returns JSON posts
@lauriejim Hi Jim, sorry for the late response on my part, I am really busy on a huge project at the moment. I don't have Postman but i could try to test it Advanced REST Client app, which i guess is similar. I might have a bit of downtime soonish or this weekend to test this out. Thank you for reaching out, i appreciate.
regarding Can't convert Integer into String. in /_layouts/home.html
article suggests to configure the permalink (_config.yml
) (therein lies the error)
IF you don't configure it, (idem comment it) it should "work"
IF you do configure it, you expect your document to contain a slug property (which you need to define as a string from your admin pannel/content-types)
IF you do configure it but select the :id instead (so you don't have to modify the content-type since strapi already serves it by default) you still get the error (for me in /var/lib/gems/2.3.0/gems/jekyll-strapi-0.1.2/lib/jekyll/strapi/site.rb::strapi_link_resolver). Apparently, you need to convert the document.id to document.id.to_s from
:placeholders => {
:id => document.id.to_s,
:uid => document.uid,
@mpech aahhhh interesting, good catch. will definitely try this out. thanks
BUMP! @lauriejim @mpech
So sorry, for the humongous delay... I was in a huge project that took all my time away. I finally found the time to dive back in this small learning tutorial.
and...
I finally got it working... I ended up updating jekyll-strapi to lastest version 0.1.2, and jekyll to version 3.8.5.
I already add the gem jekyll-strapi installed, so to update it, I did in a Terminal:
gem install jekyll-strapi
This ensure that you have the newest latest version with bug fixes.
Next, your gemfile should be configured like this:
gem "jekyll", "~> 3.8.5"
[...]
group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
gem 'jekyll-strapi', github: 'strapi/jekyll-strapi'
end
The "github: 'strapi/jekyll-strapi'" parameter will make sure you have the latest fix for the infamous bug: "Liquid Exception: Can't convert Integer into String"
One more thing, in blog/_config.yml, instead of "type: post"
strapi:
collections:
posts:
type: post
YOU NEED TO make 'post' plural. So, you will end up with:
strapi:
collections:
posts:
type: posts
If you don't you will end up with this error: "Liquid Exception: The Strapi server sent a error with the following status: 404. Please make sure it is correctly running. in /_layouts/home.html"
I hope it helps someone else struggling with this tutorial. With gems and frameworks moving and updating fast, some online tutorial become dated and out of synch with the latest builds.
Thank you for you help!
Hi, I was following this tutorial (https://blog.strapi.io/building-a-static-website-using-jekyll-and-strapi/) and everything was working fine until the "Posts List" step. Once I added the _layouts/home.html file and restarted the jekyll server (bundle exec jekyll serve), I ended up with an error message:
Thing is, the strapi server IS RUNNING... I have access to the the strapi admin backend and I can access and view the Posts object by visiting: http://localhost:1337/posts.
I'm not actually too sure what is going on and how I can fix this. Anyone else got this issue?