Day 2 - All About Jekyll
This is getting posted a day late, but for good reason! I spent all evening working in Unity, thinking I’d get a few good hours of code in, write this devlog and call it a night. But, one of the first rules of coding, never expect things to go as planned… I was up until 1am trying to suss things out with Unity, before eventually giving up and going to bed, and forgot all about the devlog. My bad.
My Journey With Jekyll
But today is a new day! And I wanted to talk first about how I actually set up this devlog. Jekyll is a static site generator. What does that mean? Well, most websites and online blogs involve a backend with a database and server. So as you browse a page there may be some back-and-forth communication between you (the client) and the server. But with a static site, you load the page once, and that’s it.
Benefits of a Backend
With a backend server, you can create your page in pieces, and combine or switch pieces on the fly. A blog page could have a header piece with the site’s menu, a footer piece with the contact and legal info, and a main section for the blog entry. When someone requests a page, the server knows to put together a header, footer, and the correct blog entry, and pass that to the client. When they want a different page, the server uses the same header and footer, but with a different main content section. If your contact info every changes, you can edit one file, and those changes will appear whenever that file is used to build a page.
Static Sites
A static site can’t do that. Every page needs to be premade with everything it needs. So a static blog has the same header and footer code copied and pasted into every file. Which is a waste of time and effort when you start getting 10s or 100s of entries. And what if you change the menu buttons or your contact info? You’ll have to go in and edit every single page again!
What is Jekyll?
A static site generator, like Jekyll, lets you build a site as if it had a backend server, creating pieces to mix and match. But then, just like with a lot of coding languages, it has to compile and build your site, stitching the pieces together for you. You might code the header and footer as seperate files. Jekyll will then copy and paste those into every blog page you have. It also let’s you code variables into your pages, that Jekyll recognizes and fills in when you compile and build it.
The two approaches result in the same product for the client. But if you don’t or can’t have a backend server to put the pieces together on the fly, you can have a static site generator do it for you before hand.
Issues with Jekyll
One of the main difficulties working with Jekyll, is that it was not designed to work on the Windows OS. Which means extra steps, running into issues, searching for fixes, finding guides or solutions that don’t quite work because their setup is slightly different than yours, etc… Thankfully, the guide I found seems to work for the most part. The only real issue I had was when trying to add on the github-pages gem. This Ruby gem is supposed to be specifically made to run Jekyll with Github-Pages in mind, adding a few features and adhering to a specific file structure. But since Jekyll wasn’t designed to work on Windows, I guess some of the settings in the Github-Pages gem don’t mesh. And after an hour of messing around with Ruby, bundle, configs, etc, I called for a git revert
, and stuck with the working setup I had. And that’s where we’re at!
Ludum Dare 40
I was gonna write about what I got up to in Unity yesterday that took me past midnight. But I’ve already been writing for a while and really want to get into today’s work. So maybe I’ll do a mid-afternoon update with that content!