Blog setup and random thoughts
Setting Up This Blog
I finally decided to create a public blog to record some thoughts that I find useful to have documented and available online. This is mainly for personal use—helping me remember setups that worked or thought processes related to specific problems and solutions. I’m still undecided about whether to overlap this with my mathematical work, both for teaching and research. On one hand, the challenge of clearly expressing thoughts and ideas—even in brief posts—could be very beneficial. On the other hand, deciding what math-related content to publish and when can be more subtle. So, for now, I’ll focus on quick posts about computer and software setups.
Hugo and Static Websites
I consider myself an old-school HTML writer: I like choosing a theme and then directly tweaking and writing my HTML code. I worked with Bootstrap when responsive design became essential, managing my personal website. This approach works well for small sites like personal pages or a few conference websites I’ve maintained. However, writing raw HTML can sometimes be tedious. Thanks to IDEs like VSCode
and my (now up-to-date) NeoVim
setup, the process has become much faster and smoother, with autocompletion and other language-server features drastically improving the workflow. Additionally, for local university servers or special setups, editing HTML directly is sometimes the only option.
Recently, I started exploring static site generators. The idea of writing readable text with minimal Markdown syntax while having a program generate the website sounded very appealing. I was initially wary of the technical setup and worried it might be more time-consuming than my previous workflow, but I decided to give it a try on a couple of projects.
Advantages and the Joy of Markdown
The initial setup was quite simple: install a static site generator locally—in my case, Hugo—via homebrew
, then choose a theme from Hugo’s growing gallery (one can also create custom themes, but that’s a project for another time). For more details, the quick start guide on Hugo’s website is very helpful.
To create your local folder for the website, just run:
hugo new site my-new-site
cd my-new-site
git init
git submodule add github-repo-of-the-theme themes/chosen_theme
echo "theme = 'chosen_theme'" >> hugo.toml
Most website settings are found in the hugo.toml
file—a configuration file written in TOML—which is readable and easy to modify for small changes. Once your config file is set up, you can add new content (e.g., blog posts) by running:
hugo new content content/posts/my-first-post.md
This creates a basic Markdown file called my-first-post.md
under the content/posts/
folder. You then simply write in Markdown—a simple, well-formatted text format supporting basic code blocks—avoiding verbose HTML tags. It’s a very convenient way to create and edit content!
Preview and HTML Generation
This is great, but two important questions remain: how can you preview the HTML pages Hugo will generate? And how do you create the actual website files to upload and publish the site?
Hugo has straightforward answers for both.
To preview the website locally, run:
hugo server -D
(from the root of your Hugo project). This starts Hugo’s development server, allowing you to view your site at http://localhost:1313/blog/posts/
(in my setup). The page updates live whenever you save any relevant file. The -D
flag tells Hugo to include drafts (new posts default to draft: true
and are otherwise hidden).
Once your site is ready for publication, simply run:
hugo
This command builds the entire static site into the public
directory at the project root. The directory contains all generated HTML files, plus assets like images, CSS, and JavaScript. You can then upload this folder to your web server—easy and stress-free!
Some Final Thoughts
This post demonstrated how to set up and run a static website with Hugo. For this blog, I’m using the Bear Cub Theme, which is free and multilingual (leaving the door open for future posts in Italian). It’s simple, easy to set up, and straightforward to tweak (I’ve only made small adjustments, so I can’t speak to more extensive modifications). The theme is minimalistic—especially in the way I use it—but includes everything I was looking for in my first static blog. So far, I’m enjoying writing and editing my pages.
I’m back to work this week and still trying to establish a proper schedule. I’m not sure how that will affect my posting frequency here, but time will tell.
Got back to work this week, and I’m still trying to fit in a proper working schedule. Not sure how this will affect the posting here but we’ll see about that.