← Back to Coffee now

Setting up the blog (I): getting started with Hugo

Coffee nowOpen original ↗

Old-fashioned typewriter

When you make the decision to start a blog, one of the first things you need to consider is what sort of system you’re going to use to organise your content.

If you read any article on starting out blogging, it will almost certainly mention WordPress. WordPress (meaning software available at https://wordpress.org, not to be confused with WordPress.com; see below) is a very common open-source content management system (CMS) for creating websites, including, but far from limited to, those dedicated to blogging. Not only that, but there are thousands of templates and plug-ins available, some free, some paid for, for you to paste (drag and drop) your content into at one end and get a site out the other, and it all claims it only takes minutes. It’s very tempting those sleek professionally designed styles set up and pre-done for you. And I’m not averse to (moderately) paying for templates, far from it, (good) graphic design is not easy and can be worth it. But it’s also the case that you very quickly run into how WordPress is a very complicated way of running a simple blog.

Behind its interface, WordPress uses PHP and a MySQL database to create your website. Now you certainly do not necessarily need to know how to write scripts or much about SQL to use the system, and PHP/MySQL is a perfectly normal way to run a website - in fact, it’s the way I used to run a website back in the early 2000s. However, it also means a lot of behind the scenes computing going on in the hosting server every time someone looks at one of your posts. Certainly for the few bits of text, silly photos and maybe the odd embedded video that is all I can ever see anything I blog about amounting to.

There’s also a few other disadvantages to using WordPress. For a start, hosting a WordPress blog for for free via WordPress.com - the commercial wing of WordPress - is a definite no from me owing to the terms that allow them to reuse your content, plus serving ads you have no control over on your site. Then there’s the difficulty making CSS changes, no ability to use JavaScript plugins and it all being quite impossible to deviate even slightly from what your template has planned for you without payments that can add up.

But even going for paid-for options to avoid such limitations (ignoring full self hosting, which is too much a security minefield), this route isn’t right for ‘coffee now’ because it also loses you so much creativity, plus it is difficult to keep it all backed up and in check. Half the ‘fun’ (OK and not a little of the stress) of this blog, is for James and me to (try) and present stuff how we want it presented, and, even if it comes out a bit amateurish, that there’s learning in the trying. Also, it’s important for us to go the way of no cookies, no ads, no tracking of visitors, no social media-required loss of privacy (well, maybe not totally; I’m sure videos will be YouTube - we’ve not unlimited bandwidth you know!).

So what other options are out there. How much time could you actually dedicate to messing around with unruly, uninterpretable code to make what you want if you were only starting with raw HTML, CSS and JavaScript?

Well, as that’s not for us either, there’s a compromise option - static site generators - and there’s several to choose from. See the list at Jamstack.

Hugo logo

This site uses one such generator - Hugo (no, not the film, not even the ‘human genome organisation’, which is most likely where I’m trying to go when I say Hugo). What the Hugo software does is take content written in markdown - think simple plain text email, so it’s super easy to write - perform some magic using a chosen template and spit out fully formatted HTML files, and it really does only take milliseconds to do that. These files are then ready to plop onto your host, and no processing on the server is required when you get a visitor (making the costs of running the blog much cheaper).

However, I have found this route is subjecting me to a fair bit of headache-inducing techy stuff from the get go. [More coffee, right now, please.]

For a start, although there’s not much to learning markdown - apart from maybe working with a text editor and not a word processor - there’s the getting your actual blog content into a git repository, a version control system, so you don’t lose track of where you are. No denying, I don’t know how to use git. So at the moment, this is a bit of an issue and definitely something I need to learn, and it’s not the easiest.

Model of the GitHub logo in front of laptop

Then, you are onto an awful lot of fiddling and adjusting of settings from within your chosen Hugo template, noting that you only get some 300 templates to choose from, not thousands. But even having chosen your template, set up it’s config file and got your content into the right place, so it might seem ready, some basic issues, such as if you want more than one author for your blog, means it’s likely not. There’s playing around with the ‘partials’, discovering you need more configuration parameters that sound scary to the uninitiated (namely, one called safeMode: unsafe - OK it’s not scary really, it just means the Hugo software allows you break out into real HTML in your markdown text when you need it, which is fine if you trust the person writing the HTML), enabling ‘pipelines’, understanding shortcodes… Plus, in our case the JavaScript isn’t all as ready in the chosen template as we’d like either. [I don’t know JavaScript any more than git of course! And that’s not one I’m about to learn just yet].

But, some typing, some cursing and some (silly) pictures later and ‘Pizza test post’ our very first blog post, is made. It’s, as you can probably guess all about pizza, home-made pizza in fact. And about now, that seems very appealing instead of more screen time. Anyone for anchovies?


Extra shots


Credits

Comments (0)

Comments (0)

No comments yet.