---
layout: post
title: "Converting To Jekyll"
date: 2022-08-24 17:08:00
excerpt_separator:
---
# Converting to Jekyll
As many of you probably noticed, our layout got more simplistic, smaller, and reminiscent of the 90's. I could make a joke about I'm a ham so I'm legally obligated to build websites like it's 1992; but that's not the truth. The truth is I like this minimalistic terminal inspired design. Is it the one I wanted? No. I found several terminal themed Hugo themes that were better. But Hugo was a pain. So...here we are.
{% raw %}
# "It's all static sites now."
Years ago I remember static sites were the norm. Sure, you had PHP and some CGI stuff; but websites were still a largely static affair. You had a webroot, all your files were there, and all URLs were relative to that. I could barely configure a webserver back then...but I could hack something together in front page, add the Blogger tags in the right places and make a site. Then...I don't know...13 years ago or so; I got in to Wordpress. I was lazy. I just wanted to write content. It took all the work out of it, ya know. I just go on, write something, publish, and with everything rendered at load I didn't have to wonder if I updated the menu on 4000 HTML files.
This, of course, comes with a downside. Wordpress is highly exploitable.
This was part of the reason I finally ditched it. Despite my best efforts to lock it down, my keeping of nothing important here in case it got hacked, and everything else; I finally had to say no more. The security issues were getting to be too much. Twice in a year I had one blog get 1000 spam posts put in it. Just one theme. With comments and everything disabled...I'm not sure where the SQL injection was occuring; I had most commands and input boxes disabled. This is the same theme that was also running a sketchy looking CRON job. As a postscript: I posted 1-star review saying I would never use those themes again. The author was VERY quick to ask about the issues...but then ghosted me after I expressed them. That was enough.
The reality is there wasn't much dynamic content here. I had a few pieces of random text and some PHP pulling from shell scripts. I can still run those scripts; just iframe embed a php, server STILL has PHP enabled since I use it for imghost. I just had to figure out what I wanted to use....and how.
# Hugo, Jekyll, & Static Site Generators
I could write very little about them. Static site generators have been around forever. Originally you were the static site generator writing all your static HTML for your web-browser. CMS-like editors existed for a while. I very clearly remember a program for Windows from the mid 90's whos goal was to help you maintain your static site. You could make changes and deploy them to all the pages that needed them. Somwhat similar in concept to what these new things do; except they render from files instead of working with a full site.
But the problem for me, as someone with little web expierence, was getting all of this working or unstand how it worked. I tried Hugo, I really did. It was the one everyone recommended. But the reality was at the end of the day; I couldn't get it to do what I want. I could build a site with it; but I was stuck using lousy themes. The ones I liked, didn't work. I literally tried for days to the point I took everything down. I think the biggest issue with Hugo is that none of my stuff was organized like a website, so I had confusion as to where to put files to render. It also refused to let me put HTML or stuff in the markdown files. Yeah...I get it...but holy cow; modifying themes to do one-off stuff was annoying. It also felt like I was mixing too many programming languages; most of which I'm not familiar with. This made trying to hack things together much more difficult.
So I decided to try Jekyll. I won't say it was easier; but clearly something about it clicked since I'm using it. It has a similar organization to Hugo in how it handles files; which is going to take some getting used to. I have to navigate deeper in to folders than I want to create posts. I did concede that there's no real difference between "pages" and "posts" from a functional standpoint. Wordpress treated them differently. This was a problem for doing things in Jekyll like generating post lists. The thing I really didn't want is to have to treat this like a manual site and update links in pages every time I added a non-blog related page. In fact when I first started...I had this little bash script written up:
```
#!/bin/bash
POSTS=$(find . -type f -exec stat -c '%Y %n' {} \; | sort -nr | awk 'NR==1,NR==3 {print $2}')
echo $POSTS
for FILE in $POSTS; do
cp -R $FILE $(pwd)/../
done
```
This script was basically finding the three most recent posts and copying them in to a directory? Why? I thought that's what I had to do. I only wanted a couple of posts on the main page; the way this theme was done it listed ALL of them. Yeah, this is because I'm an idiot and didn't bother actually reading the docs. By this point I just wanted to get ***something*** up. I was starting to feel a large level of defeat which wasn't good in my brain-fogged mental state.
Then I found the option to limit the number of posts. Oh boy. I was on to something. I just had to figure out how to make the rest of this stuff work.
I won't go in to the details. There were a few hours of raging at the monitor because gems just made no sense. Where was my theme stored? What? It made no sense. Then it did; and I started hacking on some of the theme code. I ultimately made the following modifications:
- hacking css and head.html to pick bulleted lists in the front matter
- putting a non-relative link in the menu
Now the main thing I really started to like about Jekyll was the fact I could mix HTML in my markdown. I'd tried this in Hugo and it literally yelled at me. If I wanted to do HTML snippits...there was another way I had to do them. I'm not worried about sticking to the straight markdown format; sometimes I have just snippits of code I want to use. Jekyll will let me do that. For example; the front page of this theme was originally had the display of posts as part of the theme's layout:
```
---
layout: default
---
{{ content }}
{% assign contentwonl = content | strip_newlines %} {% unless contentwonl == "" %}
{% endunless %}
{%- if site.posts.size > 0 -%}