Moving my github pages from custom CMS to Jekyll
Content management is hard, either you use a old style CMS or use a web service ( medium, wordpress, blogger ) or you do it yourself.
I tried for sometime almost all the options, and ended up with wordpress as generic tool and my own in-house version that process markdown files.
I started to write again and using github pages seems simple and is close to what I think that is a good way to write content. But still some tooling required to manage links and etc. So this time I am giving a chance to Jekyll. I never tried it before for a myriad of reasons but now I am commited to try it for real.
I am following this github tutorial to use Jekyll. Also it seems to work with github actions so I can edit on github web page, or on github mobile app or go jurassic and edit on my own desktop.
I will try to do not install anything local but let’s see how it goes.
Created the _config.yml. Edited the source to be ‘.’. Ignored the front matter, themes and plugins for now.
Now .. it suggest to build locally. It seems that I have ruby installed locally and it is on 2.6.x. Good enough.
gem install jekyll ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory. # meh
So, did not worked with system ruby, my lazyness did not pay off this time. So let’s do it the “dev” way. Following the guide on jekyll site.
I try to keep as minimal as possible the software installed on the host and I tought to use a docker but.. ok, let’s do it the old way.
brew install chruby ruby-install #(...) ruby-install ruby #(... it took a while, it compiled ruby.. feels like 1998 again) # Added this to my zsh echo "source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc echo "chruby ruby-3.1.x" >> ~/.zshrc # TIL that ruby is on 3.1.x version gem install jekyll
Somehow I got the impression that installing stuff using pip on python is wy faster than using gem. Just a impression.
Well it seems that worked. So need to bootstrap the site.
jekyll new --skip-bundle . # fails
It didn’t run on the directory that has the files, so I created on directory empty and run it, looks good. After I move it to the root.
Now I am following this guide, mostly went well.
Needed to update the versions accordly with this link, also to run locally was necessary to add webrick to the project Gemfile. So run it locally and of course it is empty.
So I wanted to run it from the root, I moved the contents of the jekyll directory that I created to root and run the server, and it server my old index.html as main page. Moved the file to another name and voi-la, somehow it got all my markdown notes as “pages”. Now I need to figure out how to move them to posts.
So for now I ignore the rest of the setting up page and went to adding content to your github pages. Let’s move the old markdown notes to posts. If that works well I will apreciate it a lot.
The markdown used by jekyll seems to be anotated, any markdown on the root is a page. The posts live on _posts directory, so now I will just move the posts there and put some metadata on them ( if required ). So I moved the files and it did not worked as I expected, of course, because I did not read the documentation. the file has to have a specific filename:
YY_MM_DD-title.markup. . Let’s rename them. Worked GREAT!
Since I wrote the texts as a notes, I am still unsure what those are really a blog post or a page, for now I posted everything on my site at 2022-01-01. Now I moved this own note/post to _posts directory and can continue the saga. Part of the intent of this new old blog/site of mine is to be more descriptive and give more context on how or why I am using or trying something. Let’s do some last adjusts and publish it. Also was not that painfull to run it locally. After some facelift let’s go back to github tutorial and publish it on my site.
One of my habits is always have a prod-dev-staging environemnts and here they manifest as a branch, so the site was on main and I tested on staging and merged on the master. Also I have a older github action that I removed since it was a kind of poor’s man jekyll. So I merged it on master, the site itself was not published and I need to configure a publishing source for it again.
Now my site seems blank. So I set the root to on staging branch and let’s see how it goes. Well it worked. The biggest classic of computation, restart your computer but now on a cloud version. On the same note, it seems that github pages have a considerable latency between the commit and build and deploy on their servers, so quick changes and commit won’t work as expected. That is one of the reasons to run it locally, and it is not a problem now. I still able to just use the github app on mobile or the web ui to write/edit something.
I am sticking with it, maybe changing the layout a bit, so far so good.