Creating a Static Site With 11ty

The journey of refreshing my website using 11ty

Published 10/26/2026

Screenshot of coehler.ca
Screenshot of coehler.ca

A few weeks ago I was perusing through YouTube when I stumbled across a video by Veronica Explains where she talks about her band's website that she created using 11ty . It looked neat, and I'd been wanting to rebuild my website for a few years now, so I thought I'd give it a go. Annnnnnnd 🄁drum roll🄁 please... I really like it!

So, what is 11ty (eleventy)? 11ty is a static site generator. That means I give it data, posts (written in simple markdown), layouts, etc. and it spits out a website in simple html and css files. There is no backend or database, just a directory structure of html, css, and any other assets which I can host for free on many different sites (in my case, directly from GitLab ).

While this article wont be a full-blown tutorial on 11ty, I will go through some of my favourite features, some problems I had to troubleshoot, and a bit of the development process.

11ty isn't magic, and thankfully isn't AI either. But that means you need to provide it with the blueprint for your site. At the core of 11ty is its layout and data cascade system. This system allows us to create pages, which use layouts, which use other layouts, and pass various data from pages up to the layouts to modify them based on the page using them. For example: All the main pages on the site use a layout called main, which in-turn uses a layout called base.

base.njk

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/assets/css/main.css" />
    <link href="/assets/css/prism-okaidia-modified.css" rel="stylesheet" />
    <title>coehler.ca - { {title} }</title>
</head>
<body>
    { {content | safe} }
</body>
</html>

Base is responsible for the html setup code including the doctype, head, and body. While the main layout sets up the header image, nav, and footer. Any page or layout which then uses the layout will have its own code inserted in the 'content' section, and the title passed up from the pages will be put in the 'title' section.

Like I said, this isn't going to be a tutorial. There are some decent video tutorials out there, I watched this series on YouTube, and that plus the docs provided a good base to set things up how I liked.

The most important thing for me when designing my new site was the theme. I created my old site when I was just learning html and css. It looked quite boring because I had very little clue how css worked (and to be fair I still find it magic most of the time). Now that I had more css skills, I wanted to make something I could truly be proud of. With that being said, I didn't want my site to look "professional" and by that I mean like every other site out there. Websites used to be interesting, they used to have personality. Now they're all either AI slop or something made from a basic template that everyone uses and hypes up on LinkedIn (also I hate LinkedIn, but that's a story for another time). A week or so prior to my decision to start working on my site, I created a new logo by doing some svg boolean magic in Inkscape. It kinda has this digital/Tron style to it so I decided to do a computer theme for the site (also being a Software Engineer, I though it was on brand). I had also seen some other website designs which incorporated the terminal aesthetic into the design and I really liked it.

That terminal was the first component I created for the website. 11ty has something called 'shortcodes'. These are sections of template code which are replaced by 11ty with other code during compilation. Something like

{ % Link "docs" "https://www.11ty.dev/docs/projects/" true % }

compiles down to an html link with 'docs' becoming the text, the link becoming the href, and the true specifying that this is an external link which should be opened in a new tab. 11ty also has 'paired shortcodes' which is like a shortcode, but has a starting and ending section. This allows you to pass more data into the component. For example, I have the Window paired shortcode.

{ % Window "title here" % }
    And whatever I put here, ends up passed to the component and rendered where I told the component to render it!
{ % endWindow % }

This draws a desktop-like window around whatever content I want. Better yet, I can then use that shortcode in pages and in posts, like I am here. If you're familiar with React-like components, this is similar (though the setup is very different). You need to create a javascript function which returns html as a string.

window.js

const Window = (content, title = '') => /*html*/`
    <div class="rounded border-2 border-[#333] overflow-auto">
        <div class="bg-[#333] flex">
            <div class="text-[#999] mr-auto ml-1 align-middle text-nowrap overflow-hidden">${title}</div>
            <div class="p-1 ml-auto mr-1 my-auto flex gap-2">
                <div class="bg-green-600 w-3 h-3"></div>
                <div class="bg-yellow-600 w-3 h-3"></div>
                <div class="bg-red-600 w-3 h-3"></div>
            </div>
        </div>
        <div class="md:text-base text-xs">
            ${content}
        </div>
    </div>
`;

export default Window;

Then you just add a line to the config file telling 11ty what the name of the shortcode is and what function to call when it sees it (note that if it's a paired shortcode, then the first parameter is the inner content). And it's as simple as that, I can then call that shortcode from anywhere instead of re-writing the code for the window every time. I can also make a change to the window and have that change show up across the entire site.

11ty isn't without its faults though. My biggest gripe with it is actually the way shortcodes are implemented. Needing to use a javascript function means my IDE doesn't interpret the code as html. Luckily I was able to find a VS code extension which added syntax highlighting to template strings (called 'Template Strings Kit' by savh). This also adds intellisense support, which makes it so much easier to write these components. The other issue I had was calling a component from within a component. This is a problem that I still haven't fully solved. I assumed I could import one component from another, but I guess however 11ty is handling them makes that not work. The other thing I tried was passing a reference to another shortcode when setting up the shortcode in the config file.

eleventy.config.js

eleventyConfig.addShortcode('Image', (filename, position, caption) => Image(Window, filename, position, caption));

This does work (here 'Window' is another shortcode), but can mess with the formatting of text going into the inner shortcode in some cases. The best workaround I found was to just nest them in the page or post itself. It makes for some repetitive code, but it keeps the formatting consistent.

{ % Window "eleventy.config.js" % }
{ % highlight js % }
eleventyConfig.addShortcode('Image', (filename, position, caption) => Image(Window, filename, position, caption));
{ % endhighlight % }
{ % endWindow % }

Other than that, I really like 11ty. The best part of 11ty (or any static site generator) has to be that now that I have my layouts setup, I can simply create a blog post by just writing a markdown(.md) file and 11ty will style it to match all my other posts. This means I don't have to worry about styling a post (other than adding images and code blocks) and can focus on writing. If you'd like to see what this blog post looks like without any of the 11ty magic to turn it into html, here is a link to a copy of this blog post which you can view in plaintext.

I think this is a good place to end this post. Maybe someday I will add more to this site. Hopefully I continue to make posts here. Even if I don't, I had a great time learning 11ty and building something that will hopefully last years and give me a place to showcase my work and express my thoughts.


                               /$$       /$$                            /$$$$$$   /$$$$$$   /$$$$$$   /$$$$$$ 
                              | $$      | $$                           /$$__  $$ /$$$_  $$ /$$__  $$ /$$__  $$
  /$$$$$$$  /$$$$$$   /$$$$$$ | $$$$$$$ | $$  /$$$$$$   /$$$$$$       |__/  \ $$| $$$$\ $$|__/  \ $$| $$  \__/
 /$$_____/ /$$__  $$ /$$__  $$| $$__  $$| $$ /$$__  $$ /$$__  $$        /$$$$$$/| $$ $$ $$  /$$$$$$/| $$$$$$$ 
| $$      | $$  \ $$| $$$$$$$$| $$  \ $$| $$| $$$$$$$$| $$  \__/       /$$____/ | $$\ $$$$ /$$____/ | $$__  $$
| $$      | $$  | $$| $$_____/| $$  | $$| $$| $$_____/| $$            | $$      | $$ \ $$$| $$      | $$  \ $$
|  $$$$$$$|  $$$$$$/|  $$$$$$$| $$  | $$| $$|  $$$$$$$| $$            | $$$$$$$$|  $$$$$$/| $$$$$$$$|  $$$$$$/
 \_______/ \______/  \_______/|__/  |__/|__/ \_______/|__/            |________/ \______/ |________/ \______/ 

footer@coehler.ca$ ls links/

footer@coehler.ca$ _