Build a static website with Eleventy |

Build a static website with Eleventy

Eleventy is a JavaScript-based alternative to Jekyll and Hugo for building static websites.

Digital images of a computer desktop
Image by :


Subscribe now

Get the highlights in your inbox every week.

A static site generator is a tool that generates a full, static HTML website based on raw data and a set of templates. It automates the task of coding individual HTML pages and gets those pages ready to serve to users. Because the HTML pages are prebuilt, they load very quickly in users' browsers.

Static sites work particularly well for documentation, too, because static sites are easy to scale, and they're an easy way to generate, maintain, and deploy your project's documentation. For these reasons, organizations often use them to document application programming interfaces (APIs), database schemas, and other information. Documentation is an important part of software development, design, and other aspects of tech. All codebases require some form of documentation, with options ranging from a simple README to full documentation.

Eleventy: A static site generator

Eleventy (11ty) is a simple static site generator and an alternative to Jekyll and Hugo. It's written in JavaScript and transforms a directory of templates (of varying types) into HTML. It's also open source, released under the MIT License.

Eleventy works with HTML, Markdown, Liquid, Nunjucks, Handlebars, Mustache, EJS, Haml, Pug, and JavaScript Template Literals.

Its features include:

  • Easy setup
  • Supports multiple template languages (e.g., Nunjucks, HTML, JavaScript, Markdown, Liquid)
  • Customizable
  • Based on JavaScript, which is familiar to many web developers and easy for new users to learn

Install Eleventy

Eleventy requires Node.js. On Linux, you can install Node.js using your package manager:

$ sudo dnf install nodejs

If your package manager doesn't have Node.js available, or if you're not on Linux, you can install it from the Node.js website.

Once Node.js is installed, use it to install Eleventy:

$ npm install -g @11ty/eleventy

That's it!

Build a static site for your documentation

Now you can start using Eleventy to build your static documentation site. Here are the steps to follow.

1. Create a package.json file

To install Eleventy into your project, you need a package.json file:

$ npm init -y

2. Install Eleventy into package.json

Install and save Eleventy into your project's package.json by running:

$ npm install-save-dev @11ty/eleventy

3. Run Eleventy

Use the npx command to run your local project's version of Eleventy. After you verify installation went as expected, try to run Eleventy:

$ npx @11ty/eleventy

4. Create some templates

Now run two commands to create two new template files (an HTML and a Markdown file):

$ cat << EOF >> index.html
<!doctype html><html>
<title>Page title</title>
<p>Hello world</p>
$ echo '# Page header' >

This compiles any content templates in the current directory or subdirectories into the output folder (which defaults to _site).

Run eleventy --serve to start a development web server.

$ npx @11ty/eleventy-serve

Open http://localhost:8080/README/ in the web browser of your choice to see your Eleventy output.

Then upload the files in _site to your web server to publish your site for the world to see.

Try Eleventy

Eleventy is a static site generator that's easy to use, template, and theme. If you're already using Node.js in your development workflow, Eleventy may be a more natural fit than Jekyll or Hugo. It provides great results quickly and saves you from complex site design and maintenance. To learn more about using Eleventy, read through its documentation.

This is based on Building a technical documentation static site for open source projects, which first appeared on Nwokocha Wisdom Maduabuchi's Medium site, and is republished with permission.

Car driving inbetween ice blocks

See how Jekyll, an open source generator of static HTML files, makes running a blog as easy as...
A person working.

If you're building a new website, a static site generator may be the right platform for you.

About the author

Nwokocha Wisdom - A software engineer with considerable experience in mobile development, native Android, and IOS development(Xcode), flutter development, Jetpack Compose, Ktor, Building a static site using Eleventy, MKDocs, and Docsify, Technical writing, Documentation Engineer, Community building/management, Firebase, Mongo Realm DB. • Developed apps from the ground up and published them successfully on Google Play • Built open-source library and an open-source contributor/ maintainer at Gnome, Firebase,...