Git and Bash The Site

As the posts on this site has grown, it has become increasingly difficult to make site-wide changes. This is mainly I personally wrote every single word for every page. So every time I make a change in site design, I have to go through every post to apply these changes. So, what else but to automate it?

Available Choices

It goes without saying that my choices are abundant. I could migrate to a CMS like WordPress or Ghost, write a JS backend script to serve the right CSS for the right page, or I could use a hosted service like Blogger or Medium.

Final Choice

In the end, I decided to do it the somewhat hard way. I didn't have a need for dynamic content and I didn't want a RAM hog on my Raspberry Pi. Neither did I want to track my site visitors or even bother having these extra functions embedded on my site. While resource scalability is a concern, I doubt that I will ever write that much content in the future. So the conclusion was to write scripts to automate the changes made to my static content.

For starters, I broke up every page into parts. From these parts, I wrote Bash scripts to re-build every page every time I add new content. For now, the "main" parts are the content, the quote attached at the bottom, and the HTML headers included in every page. I also cleaned up my drafts, my "proper" content, and garbage files that were left behind after experiments. The files were then pushed to my Git server. The shell script pulls from server, copies to the web root directory, executes the build script, and finally reloads the web server. As part of the Git initiation process, I've finally forced myself to pick up using Development and Stable branches, learning to merge changes, reset commits etc.

These scripts have been a great refresher to Bash since I have been using it less with my new job. I've also learnt a lot about organizing my thoughts and design process as to how I wanted my page to be. During the entire process, I've also learnt to use Git as part of my workflow. It has helped immensely to reverse grave mistakes or fix unsee-able bugs before pushing to production. I totally did not delete my entire website more than once.

Future Plans

The most obvious flaw in the whole decision was the integrity of the site. There is next to zero insurance that every time I push a change, I do not break the entire site. Also, I still have to remote into my server to execute the script. These flaws call for learning more tools, which I more than look forward to doing so.


Look again at that dot. That's here. That's home. That's us. On it everyone you love, everyone you know, everyone you ever heard of, every human being who ever was, lived out their lives. The aggregate of our joy and suffering, thousands of confident religions, ideologies, and economic doctrines, every hunter and forager, every hero and coward, every creator and destroyer of civilization, every king and peasant, every young couple in love, every mother and father, hopeful child, inventor and explorer, every teacher of morals, every corrupt politician, every "superstar," every "supreme leader," every saint and sinner in the history of our species lived there--on a mote of dust suspended in a sunbeam. The Earth is a very small stage in a vast cosmic arena. Think of the rivers of blood spilled by all those generals and emperors so that, in glory and triumph, they could become the momentary masters of a fraction of a dot. Think of the endless cruelties visited by the inhabitants of one corner of this pixel on the scarcely distinguishable inhabitants of some other corner, how frequent their misunderstandings, how eager they are to kill one another, how fervent their hatreds. Our posturings, our imagined self-importance, the delusion that we have some privileged position in the Universe, are challenged by this point of pale light. Our planet is a lonely speck in the great enveloping cosmic dark. In our obscurity, in all this vastness, there is no hint that help will come from elsewhere to save us from ourselves. The Earth is the only world known so far to harbor life. There is nowhere else, at least in the near future, to which our species could migrate. Visit, yes. Settle, not yet. Like it or not, for the moment the Earth is where we make our stand. It has been said that astronomy is a humbling and character-building experience. There is perhaps no better demonstration of the folly of human conceits than this distant image of our tiny world. To me, it underscores our responsibility to deal more kindly with one another, and to preserve and cherish the pale blue dot, the only home we've ever known.
- Carl Sagan