Porting my Blog to Typst (+ more)

November 13, 2026

It’s been a while since I’ve published anything on here - but life has been … life, I guess?
And between work, my thesis and other stuff, I didn’t really get around to writing anything.
Additionally, I haven’t been happy with my blog setup for a while now: Hugo kept slowing down my computer, especially when rebuilding a page, so much so that it would take a while for the page to even load. 1 Adding to that, I don’t need most of the features they are adding (with AI 🙄), and can’t be bothered to fix stuff when it changes between releases (like last time it did 😑).

How does any of that have to do with Typst?
Well; I’ve been meaning to try to rebuild my blog using Typst for a while now, and with Typst HTML support coming along fairly nicely, and allowing for multi-document export, I figured I’d give it a shot.
I got the final push when I was building a simple presentation library around reveal.js, and was amazed to see how well Typst can work with HTML.

Today, we’ll be looking at all of that.
The presentation library, the basics of how I’m now building my blog, what I like about the new setup, and what I don’t like.

Why Typst

But before we do any of that, what even is Typst and why bother?

I personally find myself easily distracted and overwhelmed by most modern UI editors and tools.
Which is why I do most of the writing I do in my Terminal using Helix, directly editing documents written in Plain Text.

The main reason I do so though, is the portability of Plain Text.
Whilst most UI tools (like your office suites) will store the data in some sort of binary format, that often can only be read by that specific program, Plain text documents don’t require fancy tooling to work with, and are human-readable by default.
All this makes them great for work that is supposed to last and be accessible to more people.
The simple format also allows for easy interoperability with a bunch of other tools, like git. 2

On their own, plain text documents can only hold a limited amount of information.
And for building structured documents you’ll need a way to encode structure and formatting into your text, which is then be interpreted by additional tooling. Such languages are commonly referred to as Markup languages.
Just like other markup languages, Typst provides a way to structure and format your text.
It also has a predefined set of components, with predefined presentation semantics, primarily allowing for PDF export, but more importantly for me: HTML export.

In contrast to Markdown, which I was using before moving to Typst, I find Typsts language specification to be more concrete and most importantly, it allows for scripting support, making it easy to build complex structures, without exceeding the bounds of the language.

Making a Presentation

As I mentioned, this all started when I was working on a presentation for uni.
Initially, I wanted to use Typst and polylux, a presentation slide library for Typst. However, I quickly found myself demotivated by the blank, boring slides.
Which was when I remembered that I had previously used reveal.js to create a dynamic presentation, which guided the audiences attention by controlling text opacity and hiding elements dynamically, allowing for incredible storytelling.
Last time, I did however use Markdown and hugo, which worked, but given that markdown isn’t meant for this kind of stuff, and has no real syntax support for it, it felt hacky. I’m also not that big of a markdown fan, as there are so many different implementations, and a bunch of useful syntax stuff is not officially implemented, like creating multi-line table entries - the workaround appears to be placing an HTML <br/> in your table entry….
Additionally, I had already sketched out some of the presentation using Typst, so it only made sense to use Typst for the new presentation as well.

That is basically the TLDR version of how typst-reveal was born.

It wraps around the reveal.js components, as well as embedding required assets, allowing you to focus on making your slides.

Important

At this point, I should probably point out that typst-reveal is heavily build around the use case of my presentation, and is probably missing features required for a broader audience.
For example, the ability to add custom classes to the wrapper components.

(I might add more features at some point, but currently don’t have the time to do so)

As per the presentation.typ example, a basic presentation could look like this:

#import "@local/typst-reveal:0.1.0" as reveal

#reveal.presentation()[
  #reveal.slide()[
    = Title Slide
  ]

  #reveal.slide()[
    Wow a slide
  ]

  #reveal.slide()[
    #reveal.slide()[
      And a nested slide
    ]
    #reveal.slide()[
      Ohh wow - it goes down
    ]
  ]
]

Animated image, showing the individual slides of the presentation. 
 The first slide has a larger headline on it, where as the other ones only have normal text. 
 By looking at the navigation arrows at the bottom right, you can see that the last two slides are transitioning vertically instead of horizontally

This basic example already contains most of the stuff I needed for my presentation, but I also wanted to be able to dynamically show list entries (so called fragments).
And this is where some of the cool Typst features come in: Especially Show-Rules. 3
Basically, they allow defining custom display behaviour for Typst-inbuilt components, like lists.

By building a simple show rule for list.item, we can generate the required HTML for reveal.js. Resulting in a slide set with items that can be shown one after the other.

// lib:
#let auto_fragmented_list(enum_body) = {
show list.item: it => html.li(class: "fragment")[
    #it.body
  ]
  html.ul()[
    #list_body
  ]
};

// presentation:
#auto_fragmented_list([
  - item 1
  - item 2
  - item 3
])

Annoyingly, that function only works for bullet lists, meaning you’d have to adapt the usage accordingly, making it harder for newcomers to get started.
I eventually learned that Typst allows you to iterate over body content. So… I took this even further, and build a proper auto_fragments function, which allows for nested lists of different types, as showcased in the auto-fragments.typ example.

Animated image, showing the individual slides of the presentation. 
 It shows numbered lists and bullet point lists being shown one item after the other. On a later slide both bullet point lists and numbered lists are nested multiple layers deep.

As you might expect, this still wasn’t enough for me, so I also build an auto_slides function, which also supports auto-fragmentation.
You can see the full usage in the auto-slides.typ example, but essentially, it automatically splits your sections into slides, by separating the headlines, as well as separating lists into fragments, allowing you to write a plain document and end up with a stunning presentation in the end.

Animated image, showing the individual slides of the presentation. 
 It consists of the title page and slides containing headlines and text. 
 A couple of slides are nested vertically as can be made out by the navigation arrows. 
 The last slide shows off the auto fragmentation working on the slide content.The last frame of the animation shows the presentation overview with multiple slides aligned into a horizontal row, with vertical columns shooting off.

Tip

You know what the funny thing is?
I haven’t actually looked at the typst-reveal source or examples since I finished working on my presentation. And I’d probably do some of the things different, now that I rebuild my entire blog using Typst. Like using a global show-rule for the presentation / auto-slides, making it even easier to get started.
I guess that is something for future me to adapt.

Why is this relevant?
Well, to put it simply: building the Typst wrapper taught me a lot about scripting in Typst, what is possible and what isn’t.
It also got me playing around with Typst and HTML elements, giving me a great jumping-off point for what was yet to come.

Recipe Charts

Not long after “finishing” work on the typst-reveal project, I stumbled upon a Fediverse post, showing a screenshot of a post talking about recipe charts.
A friend then linked me to Cooking For Engineers, where you can find a bunch of cooking cards, like this one (I did not try it, just an example).

Back then, I wasn’t actually 100% set on remaking my entire blog, and was leaning more towards producing some content targeting a print medium.
Like PDFs, which is how the Recipe Chart Library idea was born.

Through a lot of back-and-forth with said friend, we learned that the easiest approach is to nest a bunch of grids. 4
Sadly, we also realized that getting Typst to output the correct layout height was difficult if not impossible, especially without introducing dimension boundaries.
It was at that point, that the friend suggested just exporting HTML (which they weren’t interested in doing, but I certainly was). The idea was that the HTML flex and grid layouts should come in handy, making it easier to correctly size the child grids.

As of writing, the recipe-chart library isn’t public, as it’s application is pretty restricted, and I’m not entirely happy with how it works.
You will however probably see it appear in some Food blog posts from now on.

Caution

Note that the recipe chart output currently doesn’t work in RSS feed readers, unless you are viewing the proper page render.
Sorry

Write .typ source
Test the library
Make changes to the .typ file
Retest the library
Write .css source
Format the source
Publish the library

As you can see, I even added color output, to make it easier (for me) to track the connected steps. Feel free to disable it, if you find it distracting though.

But I digress.
Enough rambling - let’s look at the actually relevant stuff.

Remaking my Blog

Oh yeah… Remaking my blog… again.
Although, arguably, it’s been a while… - I think I’ve been using gohugo for years now.
Doesn’t make the rework any less easy though. I literally had to manually port all my blog posts, and the other pages.
Let me collect my thoughts, before this turns into a rant - because it definitely should not be.

OK, so regarding the post migration:
Yes, this could have been automated, and I even tried using pandoc. But a lot of the post meta-data is stored in the unofficial yaml front-matter, which pandoc can not migrate, causing it to be lost. Pandoc also added a couple opinionated layout elements, which IMO would have taken longer to remove.
And that is ignoring the Hugo shortcodes I was using and had to rebuild. 5

Besides all the annoying repetitive work, I actually quite enjoyed having the Typst scripting functionality as an abstraction over HTML.
In my opinion it works more reliably than the templating languages, that build around HTML itself, and most importantly, it can be formatted properly - my biggest annoyance with HTML templating.

With that out of my system - I’d like to take you on a small tour around my blog folder, which currently consists of the following folders:

./src/ # where I store the actual content of my blog
./static/ # place to store static files

./lib.typ # contains some re-exports of important functionality (i.e. the blog_post template and some components)
./libs/ # contains less-commonly used functionality, like the recipe-chart
./templates/ # contains templates with a scaffold for the different routes of the blog

./py/ # contains a basic atom-feed generator I wrote (in python, obviously), as I could not find a way to do it with Typst
./scripts/ # place to store helper scripts, i.e. for formatting, a live-server or building the release

main.typ # auto generates data based on metadata queries, i.e. keyword-pages

As Typst currently has no way of iterating over directories, I have index.typ files everywhere. Including the various nested files, especially in ./src and ./static.
The individual pages of the blog use global show rules, which call one of many different templates with the associated page metadata.

Templates

I’ve created a blog_post template, which I use for all my blog posts.
At the time of writing, the resulting show-rule for this post looks something like this:

#show: blog_post.with(
  title: "Porting my Blog to Typst",
  description: "I've started a couple Typst projects, and remade my blog - let's see what you might expect in the near future",
  keywords: ("coding", "typst", "blog", "announcement"),
  // I normally write posts with draft: true, and an estimated publishing-date
  // this one was originally meant as the second November post - but plans change...
  draft: true,
  published_at: datetime(year: 2026, month: 11, day: 20),
  rel: p => path(p),
)

The function used obviously depends on the specific page I want to build, but all of them have one thing in common: They expand the base template and optionally generate additional elements.
Most importantly, the blog_post template, exports metadata, which is later used to query for all blog posts, i.e. when rendering the blog post index, or the keyword index pages.
I use the same metadata trick for a few other elements which change dynamically, but the basic idea remains the same:

#metadata((
    type: "blog-post",

    title: title,

    slug: slug,
    label_name: label_name,
    route: route,

    // [...] additional post metadata

    rel: rel,
  ))

I previously mentioned that all templates expand upon the base template, and I’d like to pick that idea back up, and discuss its two most interesting attributes, namely rel and label_name.

Linking

The base template defines the generic structure of every page.
At the center of it, is a #document export, which generates the HTML file for the given route, which is constructed using the Typst Typed HTML components. It includes metadata, which is placed in the head section, but also contains the base page layout, meaning the <header> used for navigation, the <main>, into which the site content is placed, and the <footer> which you will find at the end of every page, which also contains the license details.

To be able to easily reference pages, especially those without a backing-file on disk 6, I make use of Typst labels, which basically allow assigning ids to elements, which can then be references from other places.
And because Typst labels are global across multiple documents, I can assign the label_name passed to the base component to the corresponding document, allowing me to easily reference other posts, and relying on Typst to handle the routes.
Similarly to the document labels, I also generate labels for the headlines of blog posts, which is used for the TOC 7 and for cross-linking.

Besides generating the routes HTML document, the base template can also generate alias-pages.
They contain basic HTML to redirect the user from the alias page to the actual page. Allowing me to keep my old blog links working, by redirecting to the newer version.
As with my old hugo-based setup, that redirect is implemented without JavaScript, making use of the HTML meta http-equiv attribute.

#html.meta(
  http-equiv: "refresh",
  content: "0; url=" + base_url + redirect_to,
)

Images

With the basic structure covered, let’s talk about show-rules and the rel attribute.
This will require some background knowledge - so stick with me on this one.

By default, the Typst HTML export will embed images included via the inbuilt image element into the output HTML. This inflates the HTML size, which is especially annoying if you don’t want the images to be shown (for whatever reason).
Instead, I decided to add a show-rule to the base template, that remaps the image elements to the HTML typed html.img.

Because this does not automatically include the image source file into the bundle, we have to manually copy it to the assets.
Given that Assets can only be defined top level (just like documents), we have to construct our show rule in a way that it emits metadata about the image, which we can then query top level to construct the asset:

// main.typ image asset construction

// NOTE: I have a couple different metadata constructs,
// so I query them generically and filter them for their specific use cases
#let metas = query(metadata)
  .map(it => it.value)
  .filter(it => (
    type(it) == dictionary and it.at("type", default: none) != none
  ))

// copy images to build directory
#let images = metas.filter(it => it.type == "image")
#for image in images {
  asset(image.dest, read(image.src, encoding: none))
}

Unfortunately, Typst resolves the paths in reference to the current file, calling read(image.src) from a file in a different folder than the blog post source, it will fail with a file not found error. The only way to circumvent this is by calling the path constructor function in the source document.
In my opinion this gets cumbersome really quickly, especially when using a lot of images.
Instead I opted to pass the rel attribute to my templates, which is always defined as rel: p => path(p) in the source files, and allows calling the path function in the correct file from the templates.
To be able to access this new image metadata, I then emit the corresponding metadata tags and the html.img, as mentioned above.

#show image: it => {
  // NOTE: this is a condensed version, as I apply some additional mapping here
  html.img(rel(it.source), alt: it.alt)
  metadata(
    (
      type: "image",
      name: file_name,
      src: rel(it.source),
      dest: build_file,
    ),
  }
)

As part of my libs.typ I also made a simple #img wrapper, which allows me to pass image alt text as content, by transforming it to a string internally

#img("./path/to/img.webp")[
  Alt text goes here
]

I’m not going to go into it now, because this post is already way too long and complex - or chaotic - but basically it makes use of the arguments type, and the way Typst apparently preserves path references when using it, to construct an image but in a different file than the source, without access to the rel helper. 8

Important

At this point, I should probably talk about my custom footnote renderer, which I had to build as Typst does not support footnotes with a custom html structure (which I have).
But it is very much still WIP and somewhat buggy, so I’m not really willing to show that here.

Spoiler: it uses state to track footnote references and then looks up the associated number when rendering the footnote bodies.

Closing off

I’m sorry for throwing this huge technical post at you - especially because it definitely derailed at some points.
Honestly, it is also a reference for future me, to remember some of the important technical aspects.

By no means is this a complete look at my new setup, and unless I decide to re-open-source my blog, or publish my Typst templates in a separate repo, there probably won’t be a more detailed explanation - unless you want one, then hit me up on the Fediverse.

You might also have noticed the absence of the RSS-feed-generation-topic.
That is because I just have not been able to find a way to properly generate a feed using Typst, at least not one containing the HTML content.
Instead I wrote a python script with parses the index pages and generates feeds for them. But that is a story for another time.

To be honest, I just hope that some of this was vaguely interesting or helpful, and I will hopefully see you again soon.

Note

Obviously I had to get sick
See you soon-ish, I guess

1: I don’t actually mind if the rebuild itself takes a while, as long as it doesn’t make my computer unusable.

2: I can recommend the No Boilerplate video on plain text “The Unreasonable Effectiveness Of Plain Text”

3: I’d link the proper docs here, but probably one of my biggest annoyances with Typst is that the docs aren’t that great 😭
You can find some information on the Advanced Styling page if you want to - I guess?

4: At least when the progression is somewhat linear, and the processes don’t have to branch off.

5: I actually haven’t quite finished porting all of them.
The code-playground, as seen in my CSS Calculator post isn’t working yet. Neither is the asset copying required for the 3D-Model posts.
But I plan on finishing or reworking those as time goes on.
For now, I just want to go back to writing.

6: I automatically generate dummy keyword overview pages for every keyword found in the blog posts.
Only some keywords have an actual file present, with additional metadata, so I couldn’t simply use file links.

7: I didn’t actually want to talk about the headline / TOC generation, but given that especially the headline-label-assignment caused me some frustration, let me share it, in case it helps you - note that it will only work with a custom setup, and for HTML only exports.

By default, Typst does not assign labels to headings, and trying to use a basic show-rule like the one below won’t work, as the heading referenced by #it has already been rendered into content (I think) and thus, the label can not be assigned to a basic element (the raw heading in our case).

// XXX: this won't work
#show heading: it => {
  [ #it #label(slugify(it.body)) ]
}

You might assume that you could simply regenerate the heading, but you’d be wrong, as this would lead to a cyclic show rule, which never resolves, as it constantly rematches on the new headings.

// XXX: this won't work
#show heading: it => {
  [ #heading(it.body, level: it.level, /*...*/) #label(slugify(it.body)) ]
}

One way to circumvent this is to make sure the show-rule does not match its content.
For example, in my use-case, the show-rule is only ever active in HTML export mode, which allows me to reinterpret the outlined attribute assigned to the heading by default.
Normally it is set to true, displaying the heading in the PDF outline, but I always display level 2 headlines in the TOC and nothing else, which is why I decided to “reuse” the attribute to limit the show-rule to headings that have not been processed yet (their default outlined value has not been changed):

#show heading.where(outlined: true): it => {
  [
    #heading(it.body, outlined: false) #label(
      "headline_" + meta.slug + "_" + slugify(it.body),
    )
  ]
}

Generating the TOC itself is fairly easy, as I just insert a page here() reference in the main post context, and use it to query all headings in the context, filtering them by level and displaying them as a list.

context [
  #let post_ref = here()

  // ...

  #if show_toc {
    let headings = query(
      selector(heading).within(post_ref),
    ).filter(it => it.level == 2)
    for h in headings {
      html.li(link(
        label("headline_" + meta.slug + "_" + slugify(h.body)),
        h.body,
      ))
    }
  }

8: It occurred to me, that I might not have explained properly why we can’t just copy the asset in the img helper, but I could probably write an entire post about this topic.

Basically, obtaining that path from the arguments is not possible, as it is only preserved when spreading the values, making it impossible to read the source path within Typst scripts.
It seems like the reason this works at all is because the Typst compiler somehow remembers the state internally.

But given that we can not access it, we have to inject it into a separate metadata element using the show rule in the template, which has access to the rel helper.