From architectural insights to working implementation – the complete journey from frustration to functional publishing platform
(source: https://blog.viktoradam.net/2019/03/28/netlify-hugo/)
The Final Implementation
After understanding the architectural foundations that make static site generators so powerful, it was time to build the actual system. This final episode documents the complete process – from installing Hugo to deploying on Netlify – with practical insights from actually building and launching my new technical blog.
The goal was to create a sustainable, maintainable publishing platform that would eliminate the copy-paste formatting nightmares I’d been experiencing. What I discovered was that the implementation was significantly more straightforward than I’d anticipated, taking roughly 4-6 hours total to go from zero to a fully functional technical publishing platform.
You can see the final result here at debugndiscover.netlify.app – a clean, fast-loading technical blog that handles mathematical equations, syntax highlighting, and complex diagrams without any of the manual formatting work that plagued my Medium workflow.
Prerequisites: Setting Your Foundation
Before diving into Hugo installation, ensure you have the essential tools for modern development workflows.
Git version control is essential for any serious publishing platform. If you don’t have Git installed, visit git-scm.com for installation instructions. Git transforms your content from isolated files into a complete project history, enabling version control and automated deployment workflows.
A GitHub account connects your local work to deployment systems. Sign up at github.com if needed. GitHub serves as both content backup and the trigger for automatic site rebuilds when you publish new posts.
A modern text editor improves your writing experience significantly. I use VS Code but any well-received editors you’re comfortable with (e.g., well-customized neovim) will suffice.
These tools create a professional content management workflow: write in your preferred editor, track changes with Git, collaborate through GitHub, and deploy automatically to the web.
Installing Hugo: Simpler Than Expected
Hugo installation varies by operating system, but the process is straightforward. I’ll cover the two platforms I use regularly – if you’re on a different system, Hugo’s official installation guide covers all platforms comprehensively.
macOS Installation
Homebrew provides the cleanest installation experience on macOS:
|
|
The extended edition includes advanced features like Sass processing and WebP image encoding that many themes require. This single command handles dependencies, adds Hugo to your PATH, and keeps you on the latest stable version.
Ubuntu Installation
For Ubuntu, snap packages ensure you get the latest version:
|
|
The snap package automatically updates and includes the extended features needed for modern Hugo themes. If you prefer apt, it’s available but often lags behind the current release.
Verifying Installation
Test your installation:
|
|
The +extended
indicator confirms you have the full-featured version needed for advanced themes.
Creating Your Hugo Site
Generate your site skeleton:
|
|
Hugo creates a logical directory structure that separates content from presentation:
|
|
This separation enables you to change themes without losing content or switch content management approaches without breaking your design.
Installing PaperMod Theme
After evaluating multiple Hugo themes, I chose PaperMod for its excellent balance of features, performance, and maintainability.
Install PaperMod via Git submodule:
|
|
Git submodules connect your site to the theme’s repository while keeping your customizations separate. When the theme updates, you can update cleanly without losing modifications.
Configure PaperMod by creating your hugo.yaml
:
|
|
This configuration enables syntax highlighting with line numbers, code copy buttons, and responsive light/dark themes.
Implementing Mathematical Notation and Mermaid Diagrams
While PaperMod provides built-in support for math and diagrams, I found their implementations unreliable during testing. Instead, I implemented custom solutions that provide guaranteed functionality and better control over rendering.
Understanding the Implementation Strategy
The approach uses Hugo’s template system to conditionally load JavaScript libraries only when needed. This keeps pages fast while ensuring mathematical equations and diagrams render perfectly when present.
Create the necessary layout directories:
|
|
These directories allow you to extend PaperMod’s functionality without modifying the theme directly.
Mathematical Notation with MathJax
Create layouts/partials/mathjax_support.html
:
|
|
This configuration matches the delimiters we specified in hugo.yaml
, ensuring consistent math rendering throughout your site.
Mermaid Diagram Implementation
Mermaid requires two separate implementations to handle both shortcode syntax and code fence syntax (````mermaid`). Note: While both implementations are provided, the code fence approach doesn’t work reliably in current testing. I recommend using the shortcode syntax for consistent results.
Create layouts/shortcodes/mermaid.html
:
|
|
This shortcode handles our mermaid shortcode syntax and allows optional alignment parameters.
Create layouts/_default/render-codeblock-mermaid.html
:
|
|
This template processes ````mermaid` code fences and sets a page variable to trigger JavaScript loading, though this method currently has reliability issues.
Create layouts/partials/mermaid.html
:
|
|
Conditional Loading System
Create layouts/partials/extend_head.html
:
|
|
This partial checks your post’s frontmatter for math: true
or mermaid: true
and loads the appropriate libraries.
Create layouts/partials/extend_footer.html
:
|
|
This handles the modern ES module loading for code fence Mermaid diagrams, using Hugo’s page store to detect when Mermaid content is present.
Why This Approach Works Better
This implementation provides several advantages over theme defaults:
Conditional loading – JavaScript libraries only load on pages that need them, keeping other pages fast Reliable syntax support – The shortcode approach works consistently (code fence support is included but currently unreliable) Version control – You can pin specific library versions for consistent rendering Customization – Easy to modify themes, delimiters, or initialization options
The separation between extend_head.html
and extend_footer.html
ensures MathJax loads early (in the head) while Mermaid can load later (in the footer) without affecting page rendering performance.
Testing Your Setup
Start Hugo’s development server:
|
|
Navigate to http://localhost:1313
to see your blog. The development server includes live reload – changes automatically refresh in your browser.
Create a test post:
|
|
Edit the generated file to test your features.
Deployment with Netlify
Netlify transforms your GitHub repository into a live website with global CDN distribution and automatic SSL certificates. The process is remarkably straightforward.
Prepare for deployment:
|
|
Create a GitHub repository and push your code:
|
|
Deploy on Netlify:
- Sign up at netlify.com using your GitHub account
- Click “Add new site” → “Import an existing project”
- Choose “Deploy with GitHub” and select your repository
- Configure build settings:
- Build command:
hugo
- Publish directory:
public
- Add environment variable:
HUGO_VERSION
=0.147.9
- Build command:
- Deploy your site
Create netlify.toml
in your site root for consistent builds:
|
|
Your site deploys automatically whenever you push to GitHub. Netlify assigns you a subdomain, but you can easily connect a custom domain later.
The Workflow in Practice
Your new publishing workflow eliminates the copy-paste formatting problems entirely:
- Write posts locally in markdown with full mathematical and code support
- Preview with live reload to see exactly how content will appear
- Commit and push to GitHub to trigger automatic deployment
- Site updates live within 30-60 seconds
The mathematical equations I struggled with on Medium now render beautifully. Code blocks maintain proper syntax highlighting and formatting. Complex diagrams display as intended. The semantic structure that was lost in copy-paste workflows is preserved completely.
Time Investment: Pleasantly Surprised
The entire implementation took significantly less time than I’d anticipated:
- Hugo installation and basic setup: 1-2 hours – mostly spent understanding the directory structure and basic configuration
- Netlify deployment setup: 1 hour – including account creation, repository connection, and first deployment
- PaperMod customization: 2-3 hours – configuring mathematical notation, adjusting colors, and setting up the homepage
Total time: 4-6 hours from zero to a fully functional technical publishing platform.
Most of this time was spent understanding how the pieces fit together rather than fighting with complex configurations. The documentation for both Hugo and PaperMod is excellent, and the error messages are helpful when something goes wrong.
What surprised me most was how quickly the development workflow became natural. Within a day of using the system, writing and publishing felt more fluid than it ever had on traditional platforms.
The Real-World Result
The proof is in the execution. This blog demonstrates what this system is capable of:
- Clean, fast-loading pages that prioritize content readability
- Perfect mathematical notation rendering without image conversion workflows
- Syntax highlighting that makes code examples genuinely helpful
- Responsive design that works across devices
- Sub-second page loads from global CDN distribution
Migrating Existing Content
The transition process proved surprisingly smooth when migrating my existing Medium articles. The migration primarily involved:
Adding proper frontmatter to each post. For example:
|
|
Converting Mermaid syntax from code fences to Hugo shortcodes:
- Changed from ````mermaid` code blocks to the mermaid shortcodes for reliable rendering
- A straightforward find-and-replace operation that took seconds per diagram
The remarkable part: Content that had required extensive manual formatting on Medium – mathematical equations, code blocks, complex diagrams – transferred seamlessly and now renders better than the original versions. Equations that were awkward image files on Medium became crisp, scalable mathematical notation. Code that lost syntax highlighting in copy-paste workflows now displays with proper formatting and copy buttons.
The contrast with my previous Medium workflow is stark. What used to require an hour of manual formatting corrections now takes zero additional time beyond writing the actual content.
Was It Worth the Investment?
The transition from Medium to this Hugo-based system represents more than just a technical upgrade – it’s a fundamental shift in how I approach technical communication.
The immediate benefits are clear: no more formatting battles, perfect equation rendering, and a publishing workflow that amplifies rather than constrains my thinking. Mathematical notation, code examples, and complex diagrams now enhance my explanations instead of creating obstacles.
The long-term advantages are even more significant: complete control over presentation, content that remains portable across platforms, and a system that can evolve with changing needs. I own every aspect of the publishing pipeline, from content creation to reader experience.
The 4-6 hour investment eliminated what had become hours of weekly formatting frustration. More importantly, it removed the mental overhead of wondering whether a technical concept could be properly expressed within platform limitations.
Final Reflection
The transition from Medium to this Hugo-based system addressed a specific workflow problem: the time overhead of formatting technical content. Medium never restricted my ideas, but it consistently consumed extra hours per post dealing with equation images, code formatting issues, and diagram placement, which the new Hugo setup eliminates entirely. The publishing workflow now matches the actual writing process – linear and predictable.
To my surprise, it took much fewer hours than anticipated without major hassles. More importantly, there’s a sense of ownership that subscription platforms can’t provide. The content, the presentation, and the entire publishing pipeline belong to me. If Hugo becomes unsuitable, the markdown files migrate cleanly to any other system. I also believe my migration experience this time will be transferable.
Given web originated from static sites, SSG may not be revolutionary, but as shown in my case, it can solve real problems for technical writers. When your content includes equations, code, and diagrams regularly, having tools that handle these elements naturally rather than as afterthoughts makes a measurable difference in productivity.