March 13, 2019gatsby
In former times, I blogged using jekyll, and I had my problems with it:
So I wanted to use something else …
I stumbled over Gatsby in a podcast The Changelog which sounded like it should be worth a try. But how to use it? Then I had to travel for some hours with the train, and I wanted to give it a try. First, it was a nightmare, but after having installed the relevant node projects, if went on smoothly.
I wanted to deploy the final blog with Github Pages, and so I tried first the plugin that said it will do the job. But that did not work for me.
So I used the normal tools (like gatsby build
) and added some more jobs to it. In a nutshell, it is the following line: gatsby build --prefix-paths && rm -fr docs && mv public docs
See the documentation under https://www.gatsbyjs.org/docs/path-prefix/ for details. In my case, I did:
pathPrefix: '/mliebelts-blog'
to gatsby-config.js
--prefix-paths
in your production build process.If you want to deploy on Github, you have to move your blog into the directory docs
. So by deleting the directory first all the time, and then moving the generated directory public
to docs
, everything works then.
I faced problems here or there:
.cache
was not cleaned before. So I did that regularly.Written by Markus Liebelt who lives and works near Stuttgart in Germany. You should follow him on Twitter, or see his stats on Stackoverflow.