<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Larvitz Blog - Meta</title><link href="https://hofstede.it/" rel="alternate"/><link href="https://hofstede.it/feeds/meta.atom.xml" rel="self"/><id>https://hofstede.it/</id><updated>2026-06-03T00:00:00+02:00</updated><subtitle>FreeBSD, Linux, all things cleanly engineered</subtitle><entry><title>The AI Stack I Actually Run in 2026: A Laptop iGPU and Four Rented Frontiers</title><link href="https://hofstede.it/ai-stack-2026/" rel="alternate"/><published>2026-06-03T00:00:00+02:00</published><updated>2026-06-03T00:00:00+02:00</updated><author><name>Larvitz</name></author><id>tag:blog.hofstede.it,2026-06-03:/ai-stack-2026/</id><summary type="html">&lt;p&gt;The most interesting thing about &lt;span class="caps"&gt;AI&lt;/span&gt; in 2026 is not which frontier model wins this month&amp;#8217;s benchmark. It is that the frontier became a commodity you rent through near-interchangeable clients, while the part with actual craft in it moved onto the integrated Radeon 780M in my laptop. Here is the tiered stack I actually run, with the local layer in detail because that is the unusual part, and the cloud layer kept brief because the pricing is on the vendors&amp;#8217; own pages and will be wrong by&amp;nbsp;autumn.&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;img alt="LM Studio local inference on the Radeon 780M" src="https://hofstede.it/images/2026-06-03-ai-stack-2026.png" title="Local inference in LM Studio: 20.75 tok/s for a 14B-class model on the integrated 780M"&gt;&lt;/p&gt;
&lt;p&gt;The most interesting thing about &lt;span class="caps"&gt;AI&lt;/span&gt; in 2026 is not which frontier model is winning this month. It is that the frontier became a commodity. &lt;span class="caps"&gt;GPT&lt;/span&gt;-5.5, Claude Opus 4.8, &lt;span class="caps"&gt;GLM&lt;/span&gt;-5.1, MiniMax-M3 - these are things I rent through clients and gateways that make switching providers close to a base-&lt;span class="caps"&gt;URL&lt;/span&gt; change. They are very good and almost none of the craft of using them lives in choosing between&amp;nbsp;them.&lt;/p&gt;
&lt;p&gt;The part with actual craft in it moved somewhere less glamorous: onto the integrated &lt;span class="caps"&gt;GPU&lt;/span&gt; in my laptop. That is the part of my setup people ask about, and it is the part worth writing down, so this post is built around&amp;nbsp;it.&lt;/p&gt;
&lt;p&gt;I treat models the way I treat storage. You do not buy one tier for everything. Hot data goes on NVMe, cold data on spinning rust, the archive on something cheaper still, and the skill is in the tiering, not in worshipping any single disk. My &lt;span class="caps"&gt;AI&lt;/span&gt; stack is tiered the same way: a local tier on the laptop for the constant, private, low-stakes work, a frontier tier I rent for the hard and the bulk jobs, and a clear rule for what crosses the boundary. This is that stack, not a benchmark and not a market&amp;nbsp;survey.&lt;/p&gt;
&lt;h2 id="table-of-contents"&gt;Table of&amp;nbsp;Contents&lt;/h2&gt;
&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#table-of-contents"&gt;Table of&amp;nbsp;Contents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#one-thing-up-front"&gt;One Thing Up&amp;nbsp;Front&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-stack-in-one-screen"&gt;The Stack, in One&amp;nbsp;Screen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-local-tier-an-igpu-does-more-than-you-think"&gt;The Local Tier: an iGPU Does More Than You&amp;nbsp;Think&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-frontier-tier-four-things-i-rent"&gt;The Frontier Tier: Four Things I&amp;nbsp;Rent&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#why-the-tiering-is-the-point"&gt;Why the Tiering Is the&amp;nbsp;Point&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#references"&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="one-thing-up-front"&gt;One Thing Up&amp;nbsp;Front&lt;/h2&gt;
&lt;p&gt;Modern &lt;span class="caps"&gt;AI&lt;/span&gt; has real costs: an enormous energy and water footprint, training corpora assembled on contested copyright, ongoing displacement of writers and translators and junior engineers, and a constant low background hum of model-generated slop. These are not abstract concerns; they are part of the technology I am about to describe using. My position is that &lt;span class="caps"&gt;AI&lt;/span&gt; is now the same kind of given that web search was in 2005 - refusing to engage with it costs more, in time and in relevance, than engaging with it carefully does. So I engage carefully. There is always a human in the loop, I take responsibility for what goes out under my name, and the model is a tool, not an author. It is the same reason I only ever gave the &lt;span class="caps"&gt;AI&lt;/span&gt; on my own machines &lt;a href="https://hofstede.it/interactive-system-troubleshooting-with-ai-the-linux-mcp-server/"&gt;read-only diagnostic access&lt;/a&gt; instead of a free hand. If that framing is a deal-breaker, the rest of the post will still be here if you change your&amp;nbsp;mind.&lt;/p&gt;
&lt;h2 id="the-stack-in-one-screen"&gt;The Stack, in One&amp;nbsp;Screen&lt;/h2&gt;
&lt;p&gt;Here is what I actually reach for, before any justification. This is the whole post in one table; everything after it is&amp;nbsp;detail.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Work&lt;/th&gt;
&lt;th&gt;Tier&lt;/th&gt;
&lt;th&gt;What I run&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Drafting, proofreading, tone checks&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;local&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ministral 3 14B-Reasoning on the Radeon 780M&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Translation, where the writing has to be good&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;local&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Gemma 4 &lt;span class="caps"&gt;E4B&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Short code and config snippets&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;local&lt;/strong&gt;, escalating&lt;/td&gt;
&lt;td&gt;Ministral 3 14B-Reasoning, then Opus 4.8 when it gets fiddly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Long-horizon, multi-step agentic coding&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;frontier&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Claude Opus 4.8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost-conscious agentic coding&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;frontier&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;span class="caps"&gt;GLM&lt;/span&gt;-5.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High-volume, low-stakes batch&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;frontier, cheap&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MiniMax-M3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multimodal work I just want finished&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;frontier&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;OpenAI&amp;#8217;s multimodal tier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One-off question, want a fast great answer&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;frontier&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;whichever chat app is already open&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The shape matters more than any single row. Easy, private, constant work stays local. Long, careful, expensive work goes to a frontier model. Bulk, mechanical work goes to the cheapest cloud model that can do the job. The local tier is where I spend most of my keystrokes, so that is where the rest of this post spends most of its&amp;nbsp;words.&lt;/p&gt;
&lt;h2 id="the-local-tier-an-igpu-does-more-than-you-think"&gt;The Local Tier: an iGPU Does More Than You&amp;nbsp;Think&lt;/h2&gt;
&lt;p&gt;The laptop I write on is a ThinkPad T14s Gen4 &lt;span class="caps"&gt;AMD&lt;/span&gt;, the machine that quietly replaced &lt;a href="https://hofstede.it/freebsd-150-on-the-thinkpad-t480-efficient-stable-and-8-hours-on-battery/"&gt;my old T480&lt;/a&gt;: a Ryzen 7 &lt;span class="caps"&gt;PRO&lt;/span&gt; 7840U, 32 &lt;span class="caps"&gt;GB&lt;/span&gt; of LPDDR5x, and the integrated Radeon 780M. The 780M is &lt;span class="caps"&gt;RDNA&lt;/span&gt; 3, twelve compute units, no dedicated &lt;span class="caps"&gt;VRAM&lt;/span&gt;, sharing system memory with the &lt;span class="caps"&gt;CPU&lt;/span&gt;. It is an iGPU in a thin-and-light. And it runs local LLMs every day, well enough to be useful, which is not what anyone expects from integrated&amp;nbsp;graphics.&lt;/p&gt;
&lt;p&gt;The tool is &lt;a href="https://lmstudio.ai/"&gt;&lt;span class="caps"&gt;LM&lt;/span&gt; Studio&lt;/a&gt;. The loop is: install it, browse the catalog, pull a quantised &lt;span class="caps"&gt;GGUF&lt;/span&gt;, and you are talking to a local model in under five minutes. On the 780M I use &lt;span class="caps"&gt;LM&lt;/span&gt; Studio&amp;#8217;s Vulkan runtime rather than fighting ROCm into recognising an iGPU it only unofficially supports; Vulkan just works on this hardware, which is exactly the kind of boring I want from a daily tool. The catalog is the real value: someone already curated sensible quantisations, so you are not spelunking through Hugging Face for&amp;nbsp;a &lt;code&gt;Q4_K_M&lt;/code&gt; of whatever you&amp;nbsp;need.&lt;/p&gt;
&lt;p&gt;The models I keep installed are small, locally downloadable ones with commercially usable weights that fit in shared memory, which matters when the machine processes work-related text on a closed network. Two of them do almost all of the&amp;nbsp;work:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ministral 3 14B-Reasoning&lt;/strong&gt;&amp;nbsp;(&lt;code&gt;Q4_K_M&lt;/code&gt;). The workhorse: drafting, proofreading, rewriting a clunky sentence, a second opinion on tone. With &lt;span class="caps"&gt;LM&lt;/span&gt; Studio&amp;#8217;s Vulkan runtime on Fedora, the laptop plugged in and an ordinary interactive prompt, I see roughly 21 generated tokens per second on the 780M - an everyday observation rather than a benchmark, but faster than I read. The reasoning variant is also noticeably more careful than a plain instruct model at catching the logical wobble in a paragraph before I publish&amp;nbsp;it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Gemma 4 &lt;span class="caps"&gt;E4B&lt;/span&gt;&lt;/strong&gt;&amp;nbsp;(&lt;code&gt;Q4_K_M&lt;/code&gt;). The one I switch to for translation. Carrying the meaning of a text into another language &lt;em&gt;with good writing&lt;/em&gt; is a different skill from being merely correct, and this small Gemma is the best thing I have run locally at it: the output reads like prose a person wrote, not like a model that looked words&amp;nbsp;up.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What I do &lt;strong&gt;not&lt;/strong&gt; do is try to run a 70B-class model on this thing. It will technically load, throughput collapses into single digits, and the fans pretend to be a turbine. For 70B and up you want a real &lt;span class="caps"&gt;GPU&lt;/span&gt; or you rent an H100 by the hour. The 780M is the small-and-fast tier, and that tier is more useful than its&amp;nbsp;reputation.&lt;/p&gt;
&lt;p&gt;The honest performance accounting, because almost no &lt;span class="caps"&gt;AI&lt;/span&gt; post bothers with&amp;nbsp;it:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Memory bandwidth is the ceiling, full stop.&lt;/strong&gt; The iGPU has no &lt;span class="caps"&gt;VRAM&lt;/span&gt; of its own; it reads weights out of the same LPDDR5x the &lt;span class="caps"&gt;CPU&lt;/span&gt; uses, so throughput is governed by &lt;span class="caps"&gt;RAM&lt;/span&gt; speed, not shader count. That is why the&amp;nbsp;14B &lt;code&gt;Q4&lt;/code&gt; lands where it does: comfortably interactive, nowhere near fast enough for batch. The way to go faster is a smaller model or a tighter quant, not more &lt;span class="caps"&gt;GPU&lt;/span&gt;. There is no more &lt;span class="caps"&gt;GPU&lt;/span&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quality is &amp;#8220;good enough&amp;#8221; for a clear, narrow task.&lt;/strong&gt; Proofreading, tone adjustment, light rephrasing, docstring generation, simple completions: yes. Open-ended creative writing or multi-file refactors: no. The hard stuff leaves the&amp;nbsp;laptop.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The privacy story is the entire point.&lt;/strong&gt; Inference runs locally. For sensitive work I can pull the machine off the network entirely and still get useful output, so the prompt has nowhere to go but the &lt;span class="caps"&gt;GPU&lt;/span&gt;. That is not a nice-to-have, it is the reason the setup&amp;nbsp;exists.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Q4_K_M&lt;/code&gt; is the sweet&amp;nbsp;spot.&lt;/strong&gt; &lt;code&gt;Q3&lt;/code&gt; is where the quality starts to show cracks at this model&amp;nbsp;size; &lt;code&gt;Q5&lt;/code&gt; and &lt;code&gt;Q6&lt;/code&gt; cost memory and bandwidth the 780M cannot spare for the gain. Q4_K_M is the line I stay&amp;nbsp;on.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The workflow this enables: I write in Vim, drop a paragraph into a local Mistral when I want a second opinion on tone, and only escalate to a cloud model when I am restructuring a long section or want a real critique. The local model is not a smaller cloud model. It is a different tool for a different job, the way&amp;nbsp;a &lt;code&gt;cron&lt;/code&gt; one-liner is not a smaller Ansible&amp;nbsp;playbook.&lt;/p&gt;
&lt;h2 id="the-frontier-tier-four-things-i-rent"&gt;The Frontier Tier: Four Things I&amp;nbsp;Rent&lt;/h2&gt;
&lt;p&gt;This is the commodity layer, so I will keep it short. All four are excellent, all four are closed enough at the point of use that the choice between them is mostly economic and ergonomic. The prices below are list, &lt;strong&gt;as of June 2026, and I am deliberately not going to keep them current&lt;/strong&gt; - OpenAI restructures roughly every six months, MiniMax-M3 is two days old as I write this, and the &lt;span class="caps"&gt;GLM&lt;/span&gt; tiers reshuffle constantly. Treat the table as a snapshot of the shape, not a number to plan against, and click through for anything&amp;nbsp;real.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Vendor&lt;/th&gt;
&lt;th style="text-align: right;"&gt;In / Out per 1M tokens&lt;/th&gt;
&lt;th&gt;I rent it for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Claude Opus 4.8&lt;/td&gt;
&lt;td&gt;Anthropic&lt;/td&gt;
&lt;td style="text-align: right;"&gt;$5 / $25&lt;/td&gt;
&lt;td&gt;The cleanest code and the best first-pass success on long agentic tasks. My default for anything hard.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class="caps"&gt;GPT&lt;/span&gt;-5.5&lt;/td&gt;
&lt;td&gt;OpenAI&lt;/td&gt;
&lt;td style="text-align: right;"&gt;$5 / $30&lt;/td&gt;
&lt;td&gt;The &amp;#8220;just do what I asked&amp;#8221; model and the least painful multimodal &lt;span class="caps"&gt;SDK&lt;/span&gt;. Expensive; the Batch &lt;span class="caps"&gt;API&lt;/span&gt; halves it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;span class="caps"&gt;GLM&lt;/span&gt;-5.1&lt;/td&gt;
&lt;td&gt;Z.&lt;span class="caps"&gt;AI&lt;/span&gt; (Zhipu)&lt;/td&gt;
&lt;td style="text-align: right;"&gt;$1.40 / $4.40&lt;/td&gt;
&lt;td&gt;Agentic coding at roughly a quarter of Opus pricing. Z.&lt;span class="caps"&gt;AI&lt;/span&gt; reports frontier-level &lt;span class="caps"&gt;SWE&lt;/span&gt;-Bench Pro numbers; in my own use I still reach for Opus when first-pass reliability matters more than cost.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MiniMax-M3&lt;/td&gt;
&lt;td&gt;MiniMax&lt;/td&gt;
&lt;td style="text-align: right;"&gt;$0.60 / $2.40&lt;/td&gt;
&lt;td&gt;Bulk, low-stakes batch work. &lt;strong&gt;Open-weight&lt;/strong&gt;, 1M-token context, the cheapest useful tokens in the table.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;MiniMax was running a seven-day launch discount the day I wrote this - $0.30 / $1.20 below 512K input tokens - so the table deliberately shows the standard, undiscounted rate&amp;nbsp;instead.&lt;/p&gt;
&lt;p&gt;Two of those deserve a sentence more than the table gives them, because they are the ones that surprised&amp;nbsp;me.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Opus 4.8&lt;/strong&gt; is the only one I pay full price for without flinching, because the first-pass success rate on a multi-step coding task with a real test loop is the highest here, and a result that lands the first time is cheaper than a cheap result I have to babysit. It is occasionally too cautious on sysadmin-flavoured tasks - it will refuse a perfectly legitimate operation because it pattern-matches to something risky - but that is a fair trade for the code quality. Most of this blog&amp;#8217;s tooling glue was drafted in exactly that&amp;nbsp;loop.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MiniMax-M3&lt;/strong&gt; is the one that breaks the lazy &amp;#8220;cheap Chinese model equals closed black box&amp;#8221; assumption: it launched open-weight, with a 1M-token context window, two days before this post. I will never run a 1M-context frontier model on the 780M, but &amp;#8220;I could host this myself if I had to&amp;#8221; changes the risk calculus for sensitive or long-lived work in a way a closed &lt;span class="caps"&gt;API&lt;/span&gt; never can. The cheap-1M pitch has one asterisk worth knowing - cross 512K tokens in a single request and the whole call bills at double - but for high-volume summarising and classifying it is the only model here I run without watching the&amp;nbsp;meter.&lt;/p&gt;
&lt;p&gt;&lt;span class="caps"&gt;GPT&lt;/span&gt;-5.5 and &lt;span class="caps"&gt;GLM&lt;/span&gt;-5.1 round it out and need even less from me: &lt;span class="caps"&gt;GPT&lt;/span&gt; is the safe, expensive, everywhere default with the best tool-use ecosystem, and &lt;span class="caps"&gt;GLM&lt;/span&gt; is what I reach for when I want strong agentic behaviour without Opus pricing, helped along by a coding subscription that has been advertised as low as a few dollars a month. Every vendor also sells a flat-rate chat subscription in the rough range of two coffees a month; if you want one, take whichever chat &lt;span class="caps"&gt;UI&lt;/span&gt; you actually like and add a cheap metered &lt;span class="caps"&gt;API&lt;/span&gt; key for the bulk jobs. That is genuinely all the buying advice the frontier tier&amp;nbsp;needs.&lt;/p&gt;
&lt;h2 id="why-the-tiering-is-the-point"&gt;Why the Tiering Is the&amp;nbsp;Point&lt;/h2&gt;
&lt;p&gt;That stack looks messy written out. In practice it is the opposite of messy, because each tier does the work it is shaped for and the seams between the cloud models are thin - a client or gateway config away from interchangeable. The dream of one model that is best at everything, cheapest to run, and small enough to live on a thin-and-light is not arriving in 2026, and probably not in 2027. Waiting for it is the mistake. Tiering around what exists today is the&amp;nbsp;move.&lt;/p&gt;
&lt;p&gt;So the frontier is a commodity I rent, and I have stopped having opinions about which rented frontier is marginally ahead this month, the same way I stopped caring which brand of NVMe is marginally faster. The interesting engineering, the part with craft in it, is the local tier: an integrated &lt;span class="caps"&gt;GPU&lt;/span&gt;, the kind that ships in every business laptop, that turns out to be a genuinely useful inference device once you respect what it is and stay inside its envelope. The frontier is a purchase. The local tier is a&amp;nbsp;skill.&lt;/p&gt;
&lt;p&gt;The stack is the product. Pick a few, point each one at the work it suits, keep a human in the loop, and ignore the&amp;nbsp;leaderboard.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://lmstudio.ai/"&gt;&lt;span class="caps"&gt;LM&lt;/span&gt;&amp;nbsp;Studio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mistral.ai/"&gt;Mistral &lt;span class="caps"&gt;AI&lt;/span&gt; -&amp;nbsp;models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://claude.com/pricing"&gt;Anthropic - Claude&amp;nbsp;pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://openai.com/api/pricing/"&gt;OpenAI - &lt;span class="caps"&gt;API&lt;/span&gt;&amp;nbsp;pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://z.ai/subscribe"&gt;Z.&lt;span class="caps"&gt;AI&lt;/span&gt; - &lt;span class="caps"&gt;GLM&lt;/span&gt; Coding&amp;nbsp;Plan&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://huggingface.co/MiniMaxAI"&gt;MiniMax-M3 on Hugging&amp;nbsp;Face&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;Four rented frontiers, a local Mistral, and a laptop fan that occasionally pretends to be a jet engine. The fan is the only part I had to&amp;nbsp;earn.&lt;/p&gt;</content><category term="Meta"/><category term="ai"/><category term="llm"/><category term="mistral"/><category term="gemma"/><category term="lm-studio"/><category term="amd"/><category term="radeon"/><category term="claude"/><category term="glm"/><category term="minimax"/><category term="homelab"/></entry><entry><title>Speeding Up Forgejo CI with a Custom OCI Image</title><link href="https://hofstede.it/speeding-up-forgejo-ci-with-a-custom-oci-image/" rel="alternate"/><published>2026-04-01T00:00:00+02:00</published><updated>2026-04-01T00:00:00+02:00</updated><author><name>Larvitz</name></author><id>tag:blog.hofstede.it,2026-04-01:/speeding-up-forgejo-ci-with-a-custom-oci-image/</id><summary type="html">&lt;p&gt;How I cut my blog&amp;#8217;s &lt;span class="caps"&gt;CI&lt;/span&gt;/&lt;span class="caps"&gt;CD&lt;/span&gt; build time in half by baking dependencies into a custom container image and hosting it in Forgejo&amp;#8217;s built-in &lt;span class="caps"&gt;OCI&lt;/span&gt;&amp;nbsp;registry.&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;&lt;img alt="The merged PR with the streamlined pipeline" src="https://hofstede.it/images/2026-04-01-forgejo-ci-custom-oci-image.png" title="Forgejo Actions: the pipeline after removing the install step"&gt; &lt;/p&gt;
&lt;p&gt;Every push to this blog triggers a Forgejo Actions pipeline that builds the site with Pelican, then deploys it via rsync. If you want the full picture of how this blog&amp;#8217;s infrastructure works - Bastille jails, Caddy, the whole deployment chain - I covered that in &lt;a href="https://hofstede.it/hosting-a-static-blog-on-freebsd-with-bastille-jails-and-automated-deployment/"&gt;an earlier article&lt;/a&gt;. The pipeline worked fine. But every single run started with the same&amp;nbsp;ritual: &lt;code&gt;apt-get update&lt;/code&gt;, install four system&amp;nbsp;packages, &lt;code&gt;pip install&lt;/code&gt; five Python packages. The actual build took seconds - the dependency installation took longer than the rest of the pipeline&amp;nbsp;combined.&lt;/p&gt;
&lt;p&gt;This is a solved problem in the container world. Instead of installing dependencies at runtime, bake them into the image. Here&amp;#8217;s how I did it with Forgejo&amp;#8217;s built-in container registry, keeping everything self-contained on a single Forgejo&amp;nbsp;instance.&lt;/p&gt;
&lt;h2 id="the-problem"&gt;The&amp;nbsp;Problem&lt;/h2&gt;
&lt;p&gt;My original workflow&amp;nbsp;used &lt;code&gt;python:3.11-slim&lt;/code&gt; as the &lt;span class="caps"&gt;CI&lt;/span&gt; container and installed everything from scratch on every&amp;nbsp;run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;deploy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;docker&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;python:3.11-slim&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;Install Runtime Dependencies&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p p-Indicator"&gt;|&lt;/span&gt;
&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="no"&gt;apt-get update&lt;/span&gt;
&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="no"&gt;apt-get install -y nodejs rsync openssh-client git&lt;/span&gt;
&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="no"&gt;pip install pelican pelican-sitemap markdown typogrify&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Every push - even a single typo fix - paid this tax. The install step alone accounted for the majority of the pipeline&amp;#8217;s wall clock&amp;nbsp;time.&lt;/p&gt;
&lt;h2 id="the-fix-a-custom-ci-image"&gt;The Fix: A Custom &lt;span class="caps"&gt;CI&lt;/span&gt;&amp;nbsp;Image&lt;/h2&gt;
&lt;p&gt;The solution is&amp;nbsp;a &lt;code&gt;Containerfile&lt;/code&gt; that does the installation once, at image build&amp;nbsp;time:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;python:3.11-slim&lt;/span&gt;

&lt;span class="k"&gt;RUN&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;apt-get&lt;span class="w"&gt; &lt;/span&gt;update&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;apt-get&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;-y&lt;span class="w"&gt; &lt;/span&gt;--no-install-recommends&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;       &lt;/span&gt;nodejs&lt;span class="w"&gt; &lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;openssh-client&lt;span class="w"&gt; &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;rm&lt;span class="w"&gt; &lt;/span&gt;-rf&lt;span class="w"&gt; &lt;/span&gt;/var/lib/apt/lists/*

&lt;span class="k"&gt;RUN&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;pip&lt;span class="w"&gt; &lt;/span&gt;install&lt;span class="w"&gt; &lt;/span&gt;--no-cache-dir&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;pelican&lt;span class="w"&gt; &lt;/span&gt;pelican-sitemap&lt;span class="w"&gt; &lt;/span&gt;markdown&lt;span class="w"&gt; &lt;/span&gt;typogrify
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Nothing fancy. Same base image, same packages - just shifted from &amp;#8220;every &lt;span class="caps"&gt;CI&lt;/span&gt; run&amp;#8221; to &amp;#8220;once, when I build the image&amp;#8221;.&amp;nbsp;The &lt;code&gt;--no-install-recommends&lt;/code&gt; and &lt;code&gt;--no-cache-dir&lt;/code&gt; flags keep the image&amp;nbsp;lean.&lt;/p&gt;
&lt;h2 id="forgejos-built-in-oci-registry"&gt;Forgejo&amp;#8217;s Built-in &lt;span class="caps"&gt;OCI&lt;/span&gt;&amp;nbsp;Registry&lt;/h2&gt;
&lt;p&gt;Here&amp;#8217;s the part that makes this particularly clean: Forgejo ships with a built-in &lt;span class="caps"&gt;OCI&lt;/span&gt;-compliant container registry. No need for Docker Hub, no need for a separate Harbor instance, no external dependency. Your &lt;span class="caps"&gt;CI&lt;/span&gt; images live right next to your&amp;nbsp;code.&lt;/p&gt;
&lt;p&gt;Build and push with&amp;nbsp;Podman:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;podman&lt;span class="w"&gt; &lt;/span&gt;build&lt;span class="w"&gt; &lt;/span&gt;-t&lt;span class="w"&gt; &lt;/span&gt;git.example.com/youruser/yourrepo-ci:latest&lt;span class="w"&gt; &lt;/span&gt;.
podman&lt;span class="w"&gt; &lt;/span&gt;login&lt;span class="w"&gt; &lt;/span&gt;git.example.com
podman&lt;span class="w"&gt; &lt;/span&gt;push&lt;span class="w"&gt; &lt;/span&gt;git.example.com/youruser/yourrepo-ci:latest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The image shows up under &lt;strong&gt;Packages&lt;/strong&gt; in your Forgejo instance. Same authentication, same access control, same backup strategy as the rest of your Forgejo&amp;nbsp;data.&lt;/p&gt;
&lt;h2 id="updating-the-pipeline"&gt;Updating the&amp;nbsp;Pipeline&lt;/h2&gt;
&lt;p&gt;With the image pushed, the workflow drops the install step entirely and pulls the pre-built image&amp;nbsp;instead:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;deploy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;docker&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;container&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;git.example.com/youruser/yourrepo-ci:latest&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="nt"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;${{ secrets.REGISTRY_USER }}&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;${{ secrets.REGISTRY_PASSWORD }}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p p-Indicator"&gt;-&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;Checkout Code&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l l-Scalar l-Scalar-Plain"&gt;actions/checkout@v3&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;# ... rest of pipeline unchanged&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;credentials&lt;/code&gt; block authenticates against the Forgejo registry. Store your registry username and an application token as repository&amp;nbsp;secrets.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s the entire change. The install step is gone. The pipeline goes straight from image pull to checkout to build to&amp;nbsp;deploy.&lt;/p&gt;
&lt;h2 id="the-result"&gt;The&amp;nbsp;Result&lt;/h2&gt;
&lt;p&gt;The dependency installation step disappeared completely. What used to be the slowest part of the pipeline is now a single container pull that Forgejo&amp;#8217;s runner likely has cached locally after the first run. The actual build-and-deploy cycle is all that&amp;nbsp;remains.&lt;/p&gt;
&lt;h2 id="when-to-rebuild"&gt;When to&amp;nbsp;Rebuild&lt;/h2&gt;
&lt;p&gt;The trade-off is that you now maintain a container image. In practice, this is minimal&amp;nbsp;overhead:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Adding a Pelican plugin?&lt;/strong&gt; Rebuild and push the&amp;nbsp;image&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Upgrading Python packages?&lt;/strong&gt; Rebuild and&amp;nbsp;push&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;System package update?&lt;/strong&gt; Rebuild and&amp;nbsp;push&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For a blog pipeline, that&amp;#8217;s maybe once a quarter.&amp;nbsp;The &lt;code&gt;ci-image/&lt;/code&gt; directory lives in the same repository as the blog, so the Containerfile is versioned alongside everything&amp;nbsp;else.&lt;/p&gt;
&lt;h2 id="takeaway"&gt;Takeaway&lt;/h2&gt;
&lt;p&gt;If your &lt;span class="caps"&gt;CI&lt;/span&gt; pipeline spends more time installing dependencies than doing actual work, build a custom image. If you&amp;#8217;re already running Forgejo, you have a container registry sitting right there - use it. Two commits, one Containerfile, and the entire install step&amp;nbsp;vanishes.&lt;/p&gt;
&lt;p&gt;This is one of several small improvements I&amp;#8217;ve been making to the blog over time. If you&amp;#8217;re running a Pelican blog yourself, you might also be interested in how I &lt;a href="https://hofstede.it/adding-fediverse-comments-to-a-pelican-blog/"&gt;added Fediverse-based comments&lt;/a&gt; without any server-side&amp;nbsp;dependencies.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://forgejo.org/docs/latest/user/packages/container/"&gt;Forgejo Container Registry&amp;nbsp;Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://forgejo.org/docs/latest/user/actions/"&gt;Forgejo Actions&amp;nbsp;Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/opencontainers/distribution-spec"&gt;&lt;span class="caps"&gt;OCI&lt;/span&gt; Distribution&amp;nbsp;Specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.podman.io/"&gt;Podman&amp;nbsp;Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><category term="Meta"/><category term="forgejo"/><category term="ci-cd"/><category term="containers"/><category term="oci"/><category term="pelican"/><category term="devops"/></entry><entry><title>Adding Fediverse Comments to a Pelican Blog</title><link href="https://hofstede.it/adding-fediverse-comments-to-a-pelican-blog/" rel="alternate"/><published>2026-02-10T00:00:00+01:00</published><updated>2026-02-10T00:00:00+01:00</updated><author><name>Larvitz</name></author><id>tag:blog.hofstede.it,2026-02-10:/adding-fediverse-comments-to-a-pelican-blog/</id><summary type="html">&lt;p&gt;How I added a Mastodon-based comment system to this Pelican blog - no databases, no third-party services, just the Fediverse&amp;#8217;s public &lt;span class="caps"&gt;API&lt;/span&gt; and a bit of&amp;nbsp;JavaScript.&lt;/p&gt;</summary><content type="html">&lt;hr&gt;
&lt;p&gt;Every static site eventually faces the comment question. Disqus tracks your readers. Self-hosted solutions like Commento or Isso need a server-side component and a database. Most options either compromise privacy or add operational complexity that feels disproportionate for a personal&amp;nbsp;blog.&lt;/p&gt;
&lt;p&gt;Then I came across &lt;a href="https://jan.wildeboer.net/2023/02/Jekyll-Mastodon-Comments/"&gt;Jan Wildeboer&amp;#8217;s approach&lt;/a&gt; for his Jekyll blog: use Mastodon as the comment backend. Every blog post gets a corresponding Mastodon post. Replies to that post become the article&amp;#8217;s comments, fetched client-side through the public Mastodon &lt;span class="caps"&gt;API&lt;/span&gt;. No tracking, no database, no server-side logic. Just the Fediverse doing what it already&amp;nbsp;does.&lt;/p&gt;
&lt;p&gt;I liked the idea enough to port it to Pelican. This article explains how it works, how it&amp;#8217;s integrated, and how you could do the&amp;nbsp;same.&lt;/p&gt;
&lt;h2 id="the-concept"&gt;The&amp;nbsp;Concept&lt;/h2&gt;
&lt;p&gt;The Mastodon &lt;span class="caps"&gt;API&lt;/span&gt; exposes a public endpoint that returns the full conversation context for any&amp;nbsp;post:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;GET https://instance.tld/api/v1/statuses/{id}/context
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The response includes&amp;nbsp;an &lt;code&gt;ancestors&lt;/code&gt; array (the thread above the post) and&amp;nbsp;a &lt;code&gt;descendants&lt;/code&gt; array (all replies). We only care&amp;nbsp;about &lt;code&gt;descendants&lt;/code&gt; - those are the comments. No authentication is required for public&amp;nbsp;posts.&lt;/p&gt;
&lt;p&gt;The workflow is&amp;nbsp;straightforward:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Publish your blog&amp;nbsp;article&lt;/li&gt;
&lt;li&gt;Post about it on&amp;nbsp;Mastodon&lt;/li&gt;
&lt;li&gt;Add the Mastodon post&amp;#8217;s metadata to your article&amp;#8217;s&amp;nbsp;frontmatter&lt;/li&gt;
&lt;li&gt;Rebuild the&amp;nbsp;site&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;From that point on, anyone who replies to your Mastodon post will have their reply appear as a comment on the&amp;nbsp;blog.&lt;/p&gt;
&lt;h2 id="integration-into-pelican"&gt;Integration into&amp;nbsp;Pelican&lt;/h2&gt;
&lt;h3 id="article-metadata"&gt;Article&amp;nbsp;Metadata&lt;/h3&gt;
&lt;p&gt;Pelican lets you define arbitrary metadata fields in article frontmatter. I added three fields to link an article to its Mastodon&amp;nbsp;post:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Mastodon_Host: burningboard.net
Mastodon_User: Larvitz
Mastodon_Id: 116035059515573876
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mastodon_Host&lt;/strong&gt; - the domain of the Mastodon&amp;nbsp;instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mastodon_User&lt;/strong&gt; - your handle on that&amp;nbsp;instance&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mastodon_Id&lt;/strong&gt; - the numeric status &lt;span class="caps"&gt;ID&lt;/span&gt; (grab it from the post &lt;span class="caps"&gt;URL&lt;/span&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These become available in templates&amp;nbsp;as &lt;code&gt;article.mastodon_host&lt;/code&gt;, &lt;code&gt;article.mastodon_user&lt;/code&gt;,&amp;nbsp;and &lt;code&gt;article.mastodon_id&lt;/code&gt;. Articles without these fields simply don&amp;#8217;t get a comment&amp;nbsp;section.&lt;/p&gt;
&lt;h3 id="the-comment-template"&gt;The Comment&amp;nbsp;Template&lt;/h3&gt;
&lt;p&gt;The comment system lives in a single Jinja2 include file&amp;nbsp;at &lt;code&gt;themes/pelican-alchemy-custom/templates/include/comments.html&lt;/code&gt;. The entire thing is wrapped in a&amp;nbsp;conditional:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;article.mastodon_id&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;fediverse-comments&amp;quot;&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;...
&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;{%&lt;/span&gt; &lt;span class="k"&gt;endif&lt;/span&gt; &lt;span class="cp"&gt;%}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This gets included at the bottom of the article&amp;nbsp;template:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;{&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;include&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;include/comments.html&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Since my blog uses the &lt;a href="https://github.com/nairobilug/pelican-alchemy"&gt;Alchemy&lt;/a&gt; theme, I override the&amp;nbsp;default &lt;code&gt;article.html&lt;/code&gt; in a custom template directory loaded via&amp;nbsp;Pelican&amp;#8217;s &lt;code&gt;THEME_TEMPLATES_OVERRIDES&lt;/code&gt; setting. This keeps the base theme untouched as a git submodule while allowing targeted&amp;nbsp;modifications.&lt;/p&gt;
&lt;h3 id="the-javascript"&gt;The&amp;nbsp;JavaScript&lt;/h3&gt;
&lt;p&gt;The client-side logic is compact. On page load, it fetches the conversation context and renders each&amp;nbsp;reply:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;https://{{ article.mastodon_host }}/api/v1/statuses/{{ article.mastodon_id }}/context&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;descendants&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;descendants&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;descendants&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;descendants&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;reply&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;          &lt;/span&gt;&lt;span class="c1"&gt;// Build and render each comment&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="c1"&gt;// &amp;quot;No comments yet&amp;quot; message&lt;/span&gt;
&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Each reply from the &lt;span class="caps"&gt;API&lt;/span&gt; includes the author&amp;#8217;s display name, avatar, profile &lt;span class="caps"&gt;URL&lt;/span&gt;, the reply content (as &lt;span class="caps"&gt;HTML&lt;/span&gt;), a timestamp, and engagement counts (replies, boosts, favourites). The script builds an &lt;span class="caps"&gt;HTML&lt;/span&gt; structure for each comment and appends it to the&amp;nbsp;page.&lt;/p&gt;
&lt;p&gt;One nice detail: Mastodon custom emojis in display names. The &lt;span class="caps"&gt;API&lt;/span&gt; returns&amp;nbsp;an &lt;code&gt;emojis&lt;/code&gt; array for each account, with shortcodes and image URLs. The script&amp;nbsp;replaces &lt;code&gt;:shortcode:&lt;/code&gt; patterns in display names with the actual emoji images, so usernames render&amp;nbsp;correctly.&lt;/p&gt;
&lt;h3 id="xss-protection"&gt;&lt;span class="caps"&gt;XSS&lt;/span&gt;&amp;nbsp;Protection&lt;/h3&gt;
&lt;p&gt;Since Mastodon post content arrives as &lt;span class="caps"&gt;HTML&lt;/span&gt;, rendering it directly would be a textbook &lt;span class="caps"&gt;XSS&lt;/span&gt; vulnerability. The implementation handles this in two&amp;nbsp;layers:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Manual escaping&lt;/strong&gt; - all user-controlled strings (display names, URLs, avatar paths) are run through&amp;nbsp;an &lt;code&gt;escapeHtml()&lt;/code&gt; function before being placed into the comment&amp;nbsp;markup&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DOMPurify&lt;/strong&gt; - the assembled comment &lt;span class="caps"&gt;HTML&lt;/span&gt; is sanitized through &lt;a href="https://github.com/cure53/DOMPurify"&gt;DOMPurify&lt;/a&gt; before being injected into the &lt;span class="caps"&gt;DOM&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;mastodon-comments-list&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nx"&gt;DOMPurify&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sanitize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;comment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;RETURN_DOM_FRAGMENT&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The DOMPurify library is served as a local static file rather than loaded from a &lt;span class="caps"&gt;CDN&lt;/span&gt;, avoiding external dependencies. It&amp;#8217;s registered&amp;nbsp;in &lt;code&gt;pelicanconf.py&lt;/code&gt; as a static&amp;nbsp;path:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;STATIC_PATHS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;images&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;extra/custom.css&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;extra/robots.txt&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;extra/purify.min.js&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;EXTRA_PATH_METADATA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s1"&gt;&amp;#39;extra/purify.min.js&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;path&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;purify.min.js&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="interaction-flow"&gt;Interaction&amp;nbsp;Flow&lt;/h3&gt;
&lt;p&gt;Readers who want to comment need a Mastodon (or other ActivityPub) account. The template provides a &amp;#8220;Copy post link&amp;#8221; button that copies the Mastodon post &lt;span class="caps"&gt;URL&lt;/span&gt; to the clipboard. They can then search for that &lt;span class="caps"&gt;URL&lt;/span&gt; on their own instance, find the post, and reply. Their reply will show up on the blog the next time someone loads the page - no rebuild required, since everything is fetched&amp;nbsp;live.&lt;/p&gt;
&lt;h3 id="styling"&gt;Styling&lt;/h3&gt;
&lt;p&gt;The comment section is styled to match the blog&amp;#8217;s Solarized Dark theme. Each comment is a flexbox row with a circular avatar on the left and the content on the right. Author names link to their Mastodon profiles. Dates link to the original reply. Engagement metrics (replies, boosts, favourites) are displayed in a muted&amp;nbsp;footer.&lt;/p&gt;
&lt;h2 id="trade-offs"&gt;Trade-offs&lt;/h2&gt;
&lt;p&gt;This approach has real limitations worth&amp;nbsp;acknowledging:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;JavaScript required&lt;/strong&gt; - the comments won&amp;#8217;t load without it.&amp;nbsp;A &lt;code&gt;&amp;lt;noscript&amp;gt;&lt;/code&gt; fallback tells the&amp;nbsp;reader.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Content warnings are ignored&lt;/strong&gt; - Mastodon&amp;#8217;s &lt;span class="caps"&gt;CW&lt;/span&gt; feature isn&amp;#8217;t reflected in the rendered&amp;nbsp;comments.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Media attachments are excluded&lt;/strong&gt; - only text content is&amp;nbsp;displayed.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Moderation is coarse&lt;/strong&gt; - you moderate through Mastodon itself. Blocking an account or deleting the source post affects all comments. There&amp;#8217;s no per-comment moderation from the blog&amp;nbsp;side.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The source post must stay up&lt;/strong&gt; - if you delete the Mastodon post, the comments disappear. Bookmark your&amp;nbsp;posts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;span class="caps"&gt;CORS&lt;/span&gt; dependency&lt;/strong&gt; - the Mastodon instance must allow cross-origin requests to the &lt;span class="caps"&gt;API&lt;/span&gt;, which is the default for most&amp;nbsp;instances.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;On the other hand, the advantages are compelling for a personal blog: zero infrastructure, full reader privacy, decentralized identity, and comments from people who already have Fediverse accounts - which self-selects for a community I actually want to hear&amp;nbsp;from.&lt;/p&gt;
&lt;h2 id="the-full-picture"&gt;The Full&amp;nbsp;Picture&lt;/h2&gt;
&lt;p&gt;The implementation touches exactly four&amp;nbsp;things:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;themes/pelican-alchemy-custom/templates/include/comments.html&lt;/code&gt;&lt;/strong&gt; - the template with &lt;span class="caps"&gt;HTML&lt;/span&gt; structure and JavaScript&amp;nbsp;logic&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;themes/pelican-alchemy-custom/templates/article.html&lt;/code&gt;&lt;/strong&gt; - the article template, with&amp;nbsp;one &lt;code&gt;{% include %}&lt;/code&gt; line&amp;nbsp;added&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;content/extra/purify.min.js&lt;/code&gt;&lt;/strong&gt; - DOMPurify library as a static&amp;nbsp;asset&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;content/extra/custom.css&lt;/code&gt;&lt;/strong&gt; - styling for the comment&amp;nbsp;section&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Plus three metadata fields in any article that should have comments enabled. That&amp;#8217;s it. No plugins, no external services, no build-time processing. The comments are entirely a client-side&amp;nbsp;feature.&lt;/p&gt;
&lt;p&gt;You can see it in action on my &lt;a href="https://hofstede.it/running-your-own-as-bgp-on-freebsd-with-frr-gre-tunnels-and-policy-routing/"&gt;&lt;span class="caps"&gt;BGP&lt;/span&gt; article&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="attribution"&gt;Attribution&lt;/h2&gt;
&lt;p&gt;This implementation is directly inspired by &lt;a href="https://jan.wildeboer.net"&gt;Jan Wildeboer&lt;/a&gt; (&lt;a href="https://social.wildeboer.net/@jwildeboer"&gt;@jwildeboer@social.wildeboer.net&lt;/a&gt;), who &lt;a href="https://jan.wildeboer.net/2023/02/Jekyll-Mastodon-Comments/"&gt;published this approach&lt;/a&gt; for his Jekyll blog in February 2023. I took his logic and ported it to Pelican&amp;#8217;s Jinja2 templating system. The core idea - using Mastodon&amp;#8217;s public conversation &lt;span class="caps"&gt;API&lt;/span&gt; as a comment backend - is entirely&amp;nbsp;his.&lt;/p&gt;
&lt;h2 id="references"&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://jan.wildeboer.net/2023/02/Jekyll-Mastodon-Comments/"&gt;Jan Wildeboer - Client-side comments with Mastodon on a static Jekyll&amp;nbsp;website&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.joinmastodon.org/methods/statuses/#context"&gt;Mastodon &lt;span class="caps"&gt;API&lt;/span&gt; - Get context of a&amp;nbsp;status&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/cure53/DOMPurify"&gt;DOMPurify - &lt;span class="caps"&gt;XSS&lt;/span&gt; sanitizer for &lt;span class="caps"&gt;HTML&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://getpelican.com/"&gt;Pelican - Static Site&amp;nbsp;Generator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nairobilug/pelican-alchemy"&gt;Pelican Alchemy&amp;nbsp;Theme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content><category term="Meta"/><category term="pelican"/><category term="fediverse"/><category term="mastodon"/><category term="activitypub"/><category term="blog"/><category term="javascript"/></entry></feed>