Static Site Generation: Working with Eleventy
Tags: 11ty
Published: 2022-02-28 06:26:07

I recently learned about [Static Site Generation (SSG)](https://www.freecodecamp.org/news/static-site-generation-with-nextjs/#what-is-static-generation) via [Eleventy (11ty)](https://www.11ty.dev/), and wanted to use this post to talk about how it went when I tried to use it to make a blog. 11ty is a Static Site Generator that simplifies this workflow by providing tons of plugins and a clean, intuitive developer experience. As 11ty already has a basic [Getting Started Guide](https://www.11ty.dev/docs/getting-started/), this is going to read more like a review than a tutorial.

In this review, we'll be talking about three Eleventy-based templates that I tried out:
- 11ty's [Getting Started Guide] (https://www.11ty.dev/docs/getting-started/)
- 11ty's [Base Blog] (https://github.com/11ty/eleventy-base-blog)
- Malte Ubl's Google-co-signed ["Eleventy High Performance Blog"](https://github.com/google/eleventy-high-performance-blog)  

I'll compare the three as I experienced them, and briefly comment on what it took to get them up and running. 

## 1. 11ty: Getting Started Guide ##
The most basic of the three options I'll be discussing, this was was essentially a "Hello World" boilerplate of 11ty. As I knew very little about 11ty going into messing around with it, its lack of templating had me confused _~pretty~_ quickly. However, I recognize that this was meant to be a clean slate for someone looking to have a no-frills experience with 11ty, and that's exactly what it was. I didn't feel like I was dealing with a bunch of unnecessary code, and it was very simple to work with once I did some googling.

![The home page I built](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imm0ybnwj31alsenfg04.png)

As the two templates I worked with (see options 2 and 3) had a blog-like setup, I modelled this in the same way. As you can see above, I was able to pretty quickly get some HTML up with 11ty and link to some static sites written in markdown, such as a previous blog post I had created and placed in this project:

![Blog 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uk0ebodqkaot0evecw3s.png)
 
_Yes, it looks like unformatted HTML--because it is. I put a markdown file in my directory, and out came a really clean HTML file in its own directory. Pretty cool._

If you'd like to see how I did this, here's the [GitHub repo](https://github.com/dronk6/11ty-sample) and the [site](https://dronk6.github.io/11ty-sample/index.html) I have my project hosted on.

## 2. 11ty: Base Blog ##
This was the first template I tried, also created by 11ty. Out of the three options I'm discussing, I liked this one the most for learning 11ty's features without feeling in over my head. I was able to quickly understand the logic behind the project's organization and how the components fit together, and the README that came with it was simple without being ambiguous. 

My favorite aspect of this one is that it included a lot of stylistic touches, such as having preset CSS and out-of-the-box components like a navigation bar. It made the experience of building a blog site really fast and accessible, while giving me a hint at what was possible with 11ty. Here's the home page I was able to create within ten minutes of running `npm install` for the first time: 

![Base Blog Home](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lhlw9mf9ufrv8z1vizzw.png)

As is the case with 11ty in general, all it took was me putting some formatted markdown in a file in the directory to produce this:

![Blog sample](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4kfredib4z469pk7atdy.png)

If you'd like to see my attempt at this, here's the [GitHub repo](https://github.com/dronk6/11ty-base-blog) and the [site](https://dronk6.github.io/11ty-base-blog/) I have my project hosted on. If the site shows the page without rendered CSS, yeah that confused me too--I've had a great time with GitHub Actions lately.

## 3. Malte Ubl x Google: Eleventy High Performance Blog ##
The third option I'll be discussing was also a template, created by Google's Malte Ubl. I stumbled across this while looking at 11ty templates, and was really impressed by how verbose this option was. Where the 11ty Base Blog provided a strong framework from which to build, this provided a fully-functioning, highly-stylized website that only needed to be filled in. 

Despite this being the case, I felt this template was more advanced than needed for my intent and purpose--which was actually harmful when I went to deploy it with GitHub actions. That said, it shares a lot of the benefits of 11ty's Base Blog while also including some really cool advanced features, such as support for Google Analytics and out-of-the-box testing. Plus, the pre-loaded CSS, built-in progress bar, and automatically-estimated reading times made the site look incredibly professional from the first time I built it. I was in over my head fast, but I was learning the entire time and quickly found myself looking at a high-quality product. Here's what I came up with using this template: 

![Home Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67sxrmqf6xlj1mpl9msc.png)
 
And a sample post: 

![Sample blog post](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/egiybcqhbj1s7lcojpn5.png)

The one problem I ran into with this one was when it came to CI/CD. I got the project's built-in CI to work, but for the life of me couldn't get GitHub Actions to let me build this project for deployment. The project has built-in support for [Netlify](https://www.netlify.com/), I just didn't feel like venturing down that rabbit hole. 

So, thank GitHub Actions for this meme. 

![If I had one](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bd3shkwetyn569p07zc1.png)
 
If you'd like to see my code, here's the [GitHub repo](https://github.com/dronk6/11ty-high-performance-blog) and here's where I would have put my [site](https://dronk6.github.io/11ty-high-performance-blog/) (ya know, _if I had one_).