How I built my Blog
So this is my first blog post on my freshly made Blog, and what better way to start than going full meta and talk about how i built it.
Gotta go fast!
One thing that I made priority when building this blog was making it pretty light and fast inspired by this article. What I took from it is that today’s websites are way to bloated and that prevents a lot of people with slow internet speeds of not being to enjoy them. So I proposed myself to build a simple static website with Hugo and without using any Javascript.So although I’m a programmer and using Javascript for some little stuff would have been fun I limited myself with CSS and HTML.
Using Hugo
Hugo is a pretty cool static website generator that I also found in the article above. Although I first found the structure a little confusing, I quickly found my way around it and made a really basic theme with the blank theme. For the blog posts, Hugo parses a Markdown syntax into HTML, so I am starting to learn Markdown at the same time. Maybe that will help me to finally make some more elaborate README’s for my Github projects.
Using Github Pages and automating the process.
For hosting for now I chose Github Pages although I am planning to migrate it all later on to a paid hosting service. The process of starting it was really easy following this instructions. Later I made this simple bash script inspired by the Hugo/Github tutorial.
#!/bin/sh
#Enter directory were the git repo is
cd ~/web/blog
#delete everything except the .git directory
find . -path ./.git -prune -o -exec rm -rf {} \; 2> /dev/null
#Enter the hugo directory
cd ~/blog
#Generate static website
hugo -t theme
#Move generated files to other directory
cp -b -r public/* ~/web/blog
This generates and moves the public folder (the static website that hugo generates) to a separate folder where I mantain the git repository for the website. After that I only have to commit and push the changes and it’s done!