hugo

Data Shortcode for Hugo

In the article, I show the differences in the website analytic metrics collected on the server- and client-side. It contains several dynamic values (e.g., pageviews or visits number, the date range, etc.) scattered throughout the text. To update them, I need to pass through the content and adjust them manually. So as I plan to bring the data in this post up to date regularly (I get new input every day), this task cumulatively could consume a lot of my time. Therefore, I have decided that the data in the post should be updated automatically. In this article, I describe how I have achieved this goal.

Comparing Netlify and Cloudflare Pages

The core idea of the JAMstack architecture (JavaScript, API and Markup) is to substitute dynamic webpages with pre-rendered from a template static pages that use different services exposed through Javascript API to offer dynamic features. During the last several years, the JAMstack architecture has been becoming more and more popular especially due to the proliferation of serverless paradigm. This architecture also gains its interest among bloggers who appreciate full control over their websites. Seeing the rapid development of JAMstack, several companies have started offering services for this architecture: automated builds, build previews, CDN, caching, SSL certificate provisions, hosting. Using these platforms, it is now quite easy for developer-bloggers to launch a website. To my point of view, these platforms may take a piece of a pie from traditional blogging platforms.

For the last three years, I used Netlify to host my website. I was pretty happy with the services this company provides, especially considering that they were free of charge for me. However, recently Cloudflare has also launched its JAMstack platform called Cloudflare Pages, and I decided to try it myself in order to discover its pros and cons. In this article, I compare the services provided by these companies from a blogger perspective, and share my opinion when each of them should be used.

Tmux Script to Create New Post Environment

In the article describing Tmux, as an example I have shown the script that creates an environment for writing content for my Hugo website. However, this script is not very convenient if I need to start writing a new blog post (the action that I do most often): I have to create an environment, then I must create new directory for a post, copy there a template and modify the parameters in the preamble (at least, I have to add the date and the title). Therefore, in order to facilitate this process I have developed a new script used to create an environment for writing new blog posts. In this article, I share this script and explain how it works so that you can adapt my experience in your setup.

Moving Website to Hugo Modules

Hugo 0.56.0 introduced one notable feature called “Hugo Modules”. Hugo Modules allow you to add more flexibility to your Hugo project organization. Using this feature, you can import different modules that will implement one or more Hugo component types. For instance, you can use one module that provides layout for your website, and another one to add more shortcodes, etc. Moreover, this feature enables you to mount your own directories or files that are not necessary tracked by Hugo.

For my webpage, I use a modified “Academic” theme that has been recently renamed to Wowchemy. As a part of the rebranding, the author migrated it to use Hugo Modules. I have devoted some time to understand how Hugo Modules work and how to migrate my website to use this feature. This blog post is mostly a memo for myself, however, it may be useful for others as well.