ZYVOPMulti-Platform Sync
SeriesAI NewsWhy ZyVOPJoin Discord
LoginGet Started
ZYVOP
The Developer Publishing Hub
PrivacyTermsGuidelinesDMCACommunity
© 2026 ZyVOP
HomeLearn Eleventy Part 1: Installation

Learn Eleventy Part 1: Installation

Scaffold the project

James 'Dante' Midzi
James 'Dante' Midzi
Solutions Architect
·
May 23, 2022
4 min read
Series

Eleventy

Part 2 of 4

PrevNext
Learn Eleventy Part 1: Installation
Article

UPDATE: September 2026

This series has been updated to more newer version. It was merely authored years ago.

In this article, I said that we will be doing a complete tutorial of Eleventy - from scratch to deployment. Before we get into that, let's talk a bit more about Eleventy.

How Eleventy Works

Eleventy aims to ship as little javascript as possible. It does this by rendering your source files into html and serving those static files.

Templates

Templates is the way you create your various pages in Eleventy. It supports over 3 template languages. Some of them notably:

  • html

  • markdown

  • liquid

  • nunjucks

What this means is that you have several options to how you choose to author your site. In this tutorial, we will be using markdown and nunjucks for our templates.

Requirements

At this stage, you'll need only 3 things:

  1. Node

  2. A text editor

  3. Willingness to learn p

Make sure you have node installed , then continue with this tutorial


Setup

  1. Create an empty folder anywhere on your computer and navigate into it

mkdir learneleventy
cd  learneleventy
  1. Initialise an empty package.json file with

pnpm init
  1. Install eleventy

pnpm install @11ty/eleventy

Configure Project

By default Eleventy uses files your project root to generate your site - you could place all your files there and it would work. I prefer a more ordered approach - having an src folder. Luckily for us Eleventy allows us to modify the path where it looks for source files

In your project root, create a file called eleventy.config.js and place this in it:

exprort default function (eleventyConfig) {
  return {
    dir: {
      input: "src",
      data: "_data",
      includes: "_includes",
      layouts: "_layouts",
    },
  };
};

This is our configuration file for our project. In it we define how we want a our project to behave. For now:

  • We have set our input directory to src

  • Our includes folder to _includes - Eleventy will look for this folder

  • Our layouts folder to _layouts

  • We will talk about the data folder later

With that done, we make an src in our root and that's where our files will go. Let's make two more folders in src that we will use later: _layouts and _includes

Let's make a index.md file in the root of our src and lets put some dummy content

# My Eleventy Site

I am a site made with Eleventy

Running Our Project

To run our site, type this command in your terminal

pnpm exec eleventy

Your site will be running in development on http://localhost:8080/. You will also notice that a _site folder has been generated, this is where our rendered files will go.

We don't want to always have to write this when we run our project, so let's add a script in package.json

"scripts": {
    "dev": "exec eleventy --serve",
  },

Gotcha

If we were to change anything in our index.md, those changes would not show unless reloaded the page. Eleventy requires a valid html document structure to facilitate that.

Your First Template

Let's now implement templates in our Eleventy project. In src/_layouts make a file called base.njk

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>My Eleventy Site</title>
  </head>
  <body>
    {{content | safe}}
  </body>
</html>

As you can see it's just an html document. The thing that's different is {{content | safe}}. This is where any content wrapped by our base will go.
The | safe part is a filter that tells Eleventy that the content is safe to render.

Then modify index to look like this:

---
layout: base
---

# My Eleventy Site

I am a site built with [Eleventy](https://www.11ty.io/).

We added YAML frontmatter and specify the layout that is supposed to wrap this file.

Now any changes we make to our source files will automatically update. Also, our page now has a title and doesn't say localhost:8080

NOTE : You can override the template languages in your project if you want to use anything other than markdown and nunjucks.

Using Variables In Templates

Usually each page on a site has a unique title. We have hardcoded the title. Let's improve that so that the page title is applied dynamically.

Modify our base with this

<title>My Eleventy Site - {{title}}</title>

Then our index.md YAML with thiis

---
layout: base
title: Home
---

Now when we hover over the tab we see My Eleventy Site - Home


Conclusion

Without doing a lot, we have built a website. It may not look nice right now, but it is valid webpage.

Join me in the next part as we add more to this site.

The working repository for this series can be found here: Part 1: Installation

While You wait

  • Check out the docs: https://www.11ty.dev/docs/

  • Join the Discord, a lot of helpful people in there

  • The working repository for this series can be found here: https://github.com/Psypher1/learneleventy


Thank you for reading, let's connect!

Thank you for visiting this little corner of mine. My email and DMs are always open; if you want to chat or collaborate on something, shoot me a email

Where you can get hold of me:

  • Twitter

  • <a hrer="https://discord.com/users/Pharaoh#5441/" target="_blank">Discord</a>

  • LinkedIn

Series

Eleventy

Part 2 of 4

PrevNext

Comments (0)

Join the discussion by logging into your account.

James 'Dante' Midzi
James 'Dante' Midzi

Solutions Architect

Knowledge and the sharing of it drives me. Along with improvement each day

Subscribe to James 'Dante' Midzi 's Newsletter

Direct email dispatches when new stories are published. Zero algorithms.

Like
Love
Clap
Fire
Party
Wow

More from James 'Dante' Midzi

View profile

The Reason I Prefer Opinionated UI Libraries

Explore how opinionated UI libraries like Nuxt UI simplify form handling and reduce boilerplate, compared to headless kits like ui‑thing.

3 minSep 3

Why I Avoid shadcn/ui: Design Homogenisation & Hype

Explore why shadcn/ui may lead to generic, Bootstrap‑like sites and how LLMs amplify the trend, plus my reasons for skipping this popular UI kit.

2 minSep 1

The 'AI' Problem Noone Is Talking About

In a world where the physical books are gone and one company controls your access to those digital copies, nothing stops them from denying you access.

4 minAug 25

Are You Crippled By Your Preferences

In my head as a developer, you're supposed to be able to learn anything you're driven to. Your driving tenet should be to learn. If you don't understand something you take the time to learn what it wants not what you want.

3 minAug 17

Strict Types Won't Fix Your Lack of Understanding

In development circle I am what would be considered a mid/senior developer. I have been in the trenches, seen the rise and fall of technologies. Seen the prophe...

4 minAug 7