ThinkBot

ThinkBot

System administrator with a certain tendency towards chaos.

22 Apr 2020

The story about rewriting Vitae

Three days ago I released the rewritten version of Vitae. In the beginning I just wanted to integrate my written new features better into the theme, but then as always everything turned out differently.

While I took the time to study the lines of code that Hugo-Ink provided, I quickly realized that my knowledge of HTML and CSS had diminished considerably. So I decided to refresh my knowledge in HTML and CSS and to read and understand the documentation of Hugo about templates.

I immediately compared all the new and refreshed knowledge with the files I had studied before. While going through the lines of code, I noticed that there were many inconsistencies and inappropriate lines and sections in the code. There were classes in the CSS files that were not used in any situation and were therefore unnecessary. Furthermore, the HTML and CSS style guides and code conventions were not followed.

But the biggest incomprehension caused me the following HTML file:

layouts/_default/term.html

<!DOCTYPE html>
<html>
{{ partial "head.html" . }}
<body>
	<div class="container wrapper">
		{{ partial "header.html" . }}
		<h1 class="page-title">All tags</h1>
	</div>
	{{ partial "footer.html" . }}
</body>
</html>

This term.html file was located in the layouts/_default directory and was not used at any time. I took some time to make sure that I did not miss anything. But after 2 hours of detailed examination I came to the conclusion that the file is really without any purpose.

That was the point when it was clear that I would write the theme from scratch and that I would have to improve my knowledge even further. First of all I created a clean directory structure with hugo new theme to make sure that I really start at zero. Then I bought a video course on udemy about HTML, CSS and advanced CSS. Since I can learn well with video and audio courses, I was able to make good progress quickly.

I intentionally took my time to work on the theme extensively. So I was able to decide line by line where to go with the new code.

Now after the release of 2.0 and 2.0-1 I can say that I’m really happy about the rewrite of the theme. I hope that my approach to cleanup and structure the code in a better way is also helpful to people who want to understand the theme.

For the time being this will be the final release. The only things that will be done for now is bug fixing and maintenance. This may also include big fixes like changing the font for better display of the font weight.

I want to pay more attention to this blog and other interesting topics like the Go programming language. After reading so much Hugo documentation I want to understand what exactly happens under the hood. But for that I need a good understanding of Go.