Eleventy, Zach Leatherman's static site generator for Node, supports plenty of templating languages, but the default is Liquid. Liquid has file includes built in, which means a repeated navigation block can live in one partial and be pulled into every page — the classic HTML include problem Eleventy handles without any project scaffolding.

Skipping the install step

Take a three-page site that repeats a nav chunk on every page. Move that chunk into an include file, then drop the Liquid include line into each HTML file:

{% include ./nav.html %}

Normally that template line would need Eleventy installed to be processed. It doesn't. Assuming npm is available, a single command line invocation handles it:

npx @11ty/eleventy

There is no package.json and no npm install. That makes this effectively a zero-dependency way to process a static site. Eleventy writes its output to a _site folder by default.

/my_project
- index.html
- about.html
- contact.html

Each of those HTML files needs this repeated navigation block:

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Southside Laundromat</title>
  </head>
  <body>
    {{ INCLUDE NAVIGATION HERE }}

    Unique content to this page.

  </body>
</html>

Split out into its own file, the block looks like this:

/my_project
- /_includes
  - nav.html
- index.html
- about.html
- contact.html

Which is something like:

<nav>
  <a href="/">Home</a>
  <a href="https://css-tricks.com/about/">About</a>
  <a href="https://css-tricks.com/contact/">Contact</a>
</nav>

Deploying to Netlify

For deployment, point Netlify at the _site folder as the thing to deploy. There's no need to commit that folder — and you shouldn't — so add it to a .gitignore file. Netlify builds it with the same command used locally:

Those settings can also live in a netlify.yml file if that's easier to manage than configuring the site:

build:
  command: "npx @11ty/eleventy"
  publish: _site

The tradeoff, and a bit of config

Running without an install is fast to set up, but it does cost speed: installing packages is faster both locally and for the cloud machines running your builds. The no-install route is about convenience first, not build performance.

While building the demo, a little Eleventy configuration turned out to be necessary to bring CSS files over into the processed site:

module.exports = function(eleventyConfig) {
  eleventyConfig.addPassthroughCopy("./styles");
};