WordPress REST API site on Jekyll


Would it be possible to use Jekyll to get posts from my WordPress site through the REST API and display them?

Would this be easy enough to do?


Jekyll is just a generator - it isn’t going to suck content in from that api and spit out static pages for you (at least not that I am aware of, sounds cool).

Jekyll could hold some content and some JS files and I’m sure you could use JS to suck in the API and display that content on the site in real time (after jekyll builds it).

I’ve been watching https://www.gatsbyjs.org/ - it is a bit over my head but they actively talk about using it with the WP API. I have yet to wrap my head around what they are talking about though.

Yeh, I’ve just started dabbling with Vue to try and pull posts in from my site’s API but I got stuck at setting up SEO. With Vue, if you want SEO, it’s best for the rendering to be done server-side but I don’t have Node.js on my production server(and no way of installing it).

I’ll have a look at Gatsby, I was just going to see whether Jekyll had any way of doing it but obviously not.

I feel like I’ve seen a Jekyll plugin that did this, but can’t remember where. Definitely have a look at Gatsby though, as it does everything you want.

I’d suggest playing around with their Wordpress starters to get a feel for how things work.

I did my own experiment firing up a headless CMS using Wordpress and then pointing Gatsby at it’s REST api to generate pages. It’s pretty powerful once you wrap your head around GraphQL.

There’s this Jekyll plugin, but seems like it may be broken and hasn’t been worked on in a few years.

I saw a tweet from hugo I think the other day that had stats on compilation times for a few generators, and the gatsby stat was really slow - for your test did gatsby complile quickly? I guess if it is pulling in data from an api and then compiling something it would be a little slow? was compile time an issue?

Compile times are relative to what you’re compiling. Nothing is going to beat Hugo, it’s a beast at that.

But in my tests, Gatsby is about the same as Jekyll. Where it could become slower is if you use its image features. It can automatically pickup images in your content and crank out multiple sized versions to auto generate srcset markup needed for serving responsive images.

It also does smart things with your assets and critical CSS which can add to the build time. Basically all the crazy stuff people use Gulp and Grunt to do with their asset pipelines to improve page speed, Gatsby does for you without worry.

For development it does the hot reloading thing so compile times aren’t an issue. It’s really something you only have to worry about when building for production.

ah - gotcha, that’s what matters - no worries if the compile to deploy takes a bit, but doing dev work the instant reload is hard to go back from once you have it working.

Thanks for the info, still wrapping my head around how it compares to Jekyll and Hugo. Somehow I stumbled on it very early on and have tracked it since, but have yet to take it for a spin. Interesting to see how far it has come.