Setting up my blog

Published: 2019-10-17 | Last Updated: 2021-02-02 | ~6 Minute Read

The Why

I thought about doing a blog originally about 5 years ago, I wanted to have some type of outlet but I didn’t think I would have enough to say, so I kept putting it off mainly due to that thought. After some time I just decided to go forward with it and see how it went rather than make up excuses about how I wasn’t going to have enough content for it.

The idea behind this blog is to document all things related to my progress in the Linux world and programming / web development. I wanted to have a blog that complied with a few basic rules:

  1. It had to be technical in nature
  2. It had to be made entirely from scratch
  3. It had to look modern enough for my liking
  4. I had to do it with basic tools, mainly vim

These basic rules, specially the second one, really weren’t all that bad except that I had no idea how to do it. I took a look at several of the tools out there like jekyll which has free github hosting as well. But that just didn’t seem like something I would be happy with. “Hey wanna check out my blog, I was lazy about it and just threw on it on github”… Not that there is anything wrong with doing it that way, it just didn’t seem to work well with the goals I had set for the blog.

I later took a look at other similar tools like Next.js, Hugo and Gatsby. Again, all of these were great, but I just had a different approach to it all in my mind. I wanted to really learn how to do it, how to develop it all.

There was generally one problem with that, it was absolutely daunting to think of creating something that is better than what open sourced frameworks did. I mean, there are literally thousands of commits to these projects, all done by much more experienced developers than myself. This is something that kept making me want to just tuck my nice little idea away, but my idea of doing it from scratch was just too stuck in my mind for me to give up on it, and by the same token, the idea of doing it all on my own was just too intimidating to get started.

After this initial vicious cycle of doubt and negativity, I got interested in several fields that were new to me and wanted to learn more about, mainly cloud technology. Things like docker, cloud vendors and kubernetes popped up on my radar. This was the moment of inflection for me, I just had to get something done.

The How

I got started with just a basic HTML page, no CSS at all. I wanted to keep it simple and to the point, I had already done some work on some basic applications and I simply put links to those apps in a list.

I then started looking at places where to get some insight into how to get some CSS added and not have the blog be a blank slate and actually have some type of presentation. I was recommended to Jeremy Thomas' Web Design in 4 minutes. And basically used that as a starting point.

I then added a menu based off of W3 School’s Navbar samples. I know everyone complains about them not having proper code and such, but they have some very nice HOW TOs that in my opinion get things done.

Once I had that set up I had to figure out a way to get content up and quickly, this is mainly where things like a framework would be of great help. Because you can get one or two pages done in HTML without thinking too much about it, but once I had several dozen pages to write, I would probably get to a point where I would appreciate the consistency and ease of a framework.

I had to figure out a way of getting that done on my own, from scratch. Seeing as I wanted to use vim and had used the vimwiki before, I wanted to have a similar workflow for blog posts. The main feature that got me thinking like this was the :Vimwiki2HTML feature that the vimwiki program contains. I also used Markdown for my vimwiki so I wanted to keep doing everything in markdown.

When I initially changed from the vimwiki syntax to markdown I noticed that the :Vimwiki2HTML feature didn’t support that, and I decided to create a script that basically replaced this functionality by using the discount program. Seeing as this was pretty generic I thought the same could be done for the blog. I modified the initial script that I already had, and got the basic workflow done. The current state of the script is listed below:

 #! /bin/bash

 echo "Bash version ${BASH_VERSION}"

 echo "Building Website"

 sleep 1

 for file in /some/path/*.md
 do
    if [ -z "$(ls -A /some/path/html/)" ]; then
    fname=`basename "$file" | cut -d "." -f 1`
       echo "This is the first time building the website, creating $fname"
    markdown $file > /some/path/html/$fname  
    cat head.txt /some/path/html/$fname footer.txt > /some/path/html/$fname.html
    rm /some/path/html/$fname
    else
    fname=`basename "$file" | cut -d "." -f 1`
          echo "Creating $fname"
       markdown $file > /some/path/html/$fname  
    cat head.txt /some/path/html/$fname footer.txt > /some/path/html/$fname.html
    rm /some/path/html/$fname
    fi
 done

 echo "Website Built, opening Firefox"

 sleep 1

 xdg-open /some/path/html/index.html

This script basically does the following:

  1. Checks if a folder is empty and based on if it’s empty or not does the same action but prints a different message (This is not really necessary, but I keep it around for some reason)
  2. Reads the contents of the folder in which the .md files are stored and iterates through each .md file that it finds
  3. During its iterations it uses the discount tool to parse the markdown format to HTML
  4. It then adds some header and footer information by using the cat bash command and outputs the final HTML file
  5. Then it does minimal house keeping and deletes the initial HTML file
  6. At the end it opens a file so I can see the page locally, again this is not entirely necessary

Although this is a very simple script, and to be honest could be vastly improved, it is what I am currently using in order to get the blog posts of the blog easily and automatically generated from my original markdown files, so it works for me.

Once this is done I do a test drive of the page locally and then publish it to nixing.mx.

Conclusion

I hope this gives some insight to some people out there that, like myself, are stuck in a vicious cycle of whether they should or could do a blog in a simple way. This works for me so far, and as I make changes to my workflow I will mention them here.

There are many features that I want to add to the website that I think are very important and don’t yet have, however starting somewhere and seeing progress keeps me motivated on learning how to develop those features instead of worrying about why I haven’t done anything.

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~grokkingnix/blog@lists.sr.ht [mailing list etiquette] [mailing list archive]


Posts from blogs I follow:

Introducing a Falkon extension RSS Finder

This weekend I decided to semi automate the process of searching for RSS feeds on websites while using Falkon web brosers. Many websites provide RSS feeds but do not provide any visible link or icon to access them (eg. many Wordpress based sites) and I ha…

via My land January 23, 2022
Help Chile write free software values, privacy, and digital sovereignty into their constitution

For those out of the loop, a group which included myself up until recently,1 Chile is in the midst of a revolution. They’re fighting against the increased cost of living, privatization of essential services, and worsening inequality — problems facing everyon…

via Drew DeVault's blog January 19, 2022
A warning to business owners and managers, you are a big part of the problem!

In my last couple of articles, mainly So-called modern web developers are the culprits and Is the madness ever going to end? I have written about some of the major problems with so-called modern web development and I have addressed the issues to the devel…

via unixsheikh.com January 13, 2022

Generated by openring