<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Hugo on Such geek. Wow.</title><link>https://www.ericlight.com/tags/hugo.html</link><description>Recent content in Hugo on Such geek. Wow.</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Thu, 27 Aug 2026 00:00:00 +1200</lastBuildDate><atom:link href="https://www.ericlight.com/tags/hugo/index.xml" rel="self" type="application/rss+xml"/><item><title>DR planning (aka how to rebuild my PC)</title><link>https://www.ericlight.com/post/disaster-recovery.html</link><pubDate>Thu, 27 Aug 2026 00:00:00 +1200</pubDate><guid>https://www.ericlight.com/post/disaster-recovery.html</guid><description>&lt;img src="https://www.ericlight.com/post/disaster-recovery/gmktec.png" alt="Featured image of post DR planning (aka how to rebuild my PC)" /&gt;&lt;p&gt;This one is written for future me, when I inevitably suffer the consequences of buying a $150 micro-PC from AliExpress equipped with an SSD that was swept off the floor after a flood.&lt;/p&gt;
&lt;p&gt;&amp;hellip; I regret nothing.&lt;/p&gt;
&lt;p&gt;Anyway.&lt;/p&gt;
&lt;p&gt;The blog itself is just static files (at some point I&amp;rsquo;ll write up the Pelican -&amp;gt; Hugo journey), so although the blog will keep running, I&amp;rsquo;ll have lost the ability to change anything. This blog has been written as I&amp;rsquo;ve set up my toolchain on a brand-new machine, so it&amp;rsquo;s kinda my disaster recovery plan.&lt;/p&gt;
&lt;h2 id="the-toolchain"&gt;The toolchain
&lt;/h2&gt;&lt;p&gt;I run Debian, and this blog is based on Hugo now, so grab the extended Hugo binary from &lt;a class="link" href="https://github.com/gohugoio/hugo/releases" target="_blank" rel="noopener"
 &gt;the releases page&lt;/a&gt; and get the non-snapd version of &lt;a class="link" href="https://github.com/sass/dart-sass/releases" target="_blank" rel="noopener"
 &gt;Dart Sass&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo apt install -y git curl golang-go
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tar xzf ~/Downloads/hugo_extended_*.tar.gz -C ~ hugo
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tar xzf ~/Downloads/dart-sass-*-linux-x64.tar.gz -C ~/Downloads
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo mv ~/hugo /usr/local/bin/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo mv ~/Downloads/dart-sass /opt/
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;sudo ln -sf /opt/dart-sass/sass /usr/local/bin/sass
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hugo version
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="the-keys"&gt;The keys
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;New machine, new keys&lt;/em&gt;&lt;/strong&gt;, or so they say.&lt;/p&gt;
&lt;p&gt;Lol nevermind, nobody says that. Restore them from my password manager like an adult. Then rebuild &lt;code&gt;~/.ssh/config&lt;/code&gt;. &lt;em&gt;(make sure the blog server is the top line, for reasons that will soon become apparent)&lt;/em&gt;&lt;/p&gt;
&lt;h2 id="restore-the-blog-content"&gt;Restore the blog content
&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;git clone git@github.com:rhyven/ericlight.com.git ericlight.com
cd ericlight.com
hugo mod get
hugo --minify --gc
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That&amp;rsquo;ll bring down the content of the blog itself, along with &lt;code&gt;go.mod&lt;/code&gt; which will automatically pull down the Stack theme once we run &lt;code&gt;hugo mod get&lt;/code&gt;. This is the point where I can have a look with &lt;code&gt;hugo server&lt;/code&gt; and have a sense-check.&lt;/p&gt;
&lt;p&gt;Incidentally, that also pins the Stack theme to the version I was running; update that with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;hugo mod get -u github.com/CaiJimmy/hugo-theme-stack/v4
hugo mod tidy
rm -rf public resources/_gen
hugo server
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;[this will absolutely rumble CSP ffs]&lt;/p&gt;
&lt;h2 id="the-publish-script"&gt;The publish script
&lt;/h2&gt;&lt;p&gt;Recreate &lt;code&gt;publish_blog.sh&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;#!/usr/bin/env bash
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;set -e
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;SERVER&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;awk &lt;span style="color:#e6db74"&gt;&amp;#39;/^Host /{print $2; exit}&amp;#39;&lt;/span&gt; ~/.ssh/config&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cd ~/ericlight.com
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rm -rf public resources/_gen
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hugo --minify --gc
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -az --delete --dry-run --itemize-changes public/ &lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;$SERVER&lt;span style="color:#e6db74"&gt;:/var/www/ericlight.com/&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;echo
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;read -r -p &lt;span style="color:#e6db74"&gt;&amp;#34;Dry-run info above. Hit Ctrl+C now if that looks cursed, or Enter to publish.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rsync -az --delete public/ &lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt;$SERVER&lt;span style="color:#e6db74"&gt;:/var/www/ericlight.com/&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;em&gt;Oh yeah, it&amp;rsquo;s all coming together.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id="writing-a-post"&gt;Writing a post
&lt;/h2&gt;&lt;p&gt;Hugo posts are &lt;em&gt;page bundles&lt;/em&gt; (unlike Pelican, from which I&amp;rsquo;ve recently migrated), so it&amp;rsquo;s a directory with an &lt;code&gt;index.md&lt;/code&gt; in it, and the images live alongside:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;mkdir ~/ericlight.com/content/post/yeah-so-my-ssd-finally-shat-the-bed
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Front matter needs &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;date&lt;/code&gt;, &lt;code&gt;categories&lt;/code&gt;, &lt;code&gt;tags&lt;/code&gt;, &lt;code&gt;summary&lt;/code&gt;, and maybe even a hero &lt;code&gt;image&lt;/code&gt; to make it all look nice.&lt;/p&gt;
&lt;p&gt;Images go in the post&amp;rsquo;s own folder, referenced by bare filename:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;![Alt-text for screen readers](screenshot.png &amp;quot;The caption everyone sees&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Leave the caption off and the theme just shows the alt text instead, which is usually fine.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;draft: true&lt;/code&gt; plus &lt;code&gt;hugo server -D&lt;/code&gt; to preview before committing to anything.&lt;/p&gt;
&lt;h2 id="publishing-it"&gt;Publishing it
&lt;/h2&gt;&lt;pre&gt;&lt;code&gt;git add -A
git commit -m &amp;quot;New post: ssd failure post, as predicted&amp;quot;
git push
./publish_blog.sh
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;git add -A&lt;/code&gt; rather than &lt;code&gt;git add .&lt;/code&gt;, because &lt;code&gt;-A&lt;/code&gt; catches deletions too.&lt;/p&gt;
&lt;h2 id="what-about-things-that-arent-the-blog-eric"&gt;What about things that aren&amp;rsquo;t the blog, Eric?
&lt;/h2&gt;&lt;p&gt;There isn&amp;rsquo;t much! I&amp;rsquo;d need to reinstall Steam and StarCraft, reinstall the ESPHome builder and connect it to Home Assistan&amp;hellip; that&amp;rsquo;s about it.&lt;/p&gt;
&lt;p&gt;In fact, this article&amp;rsquo;s mere existence illustrates a regression towards infrastructure managment that I&amp;rsquo;m not entirely pleased with&amp;hellip;&lt;/p&gt;
&lt;p&gt;Until next time!&lt;/p&gt;</description></item></channel></rss>