bantam.hostbantam.host
CLI Guide

Deploy Eleventy with Bantam CLI

A simpler static site generator with powerful features

Install Bantam CLI:

npm install -g @bantamhq/cli

View on NPM: @bantamhq/cli

Quick start:

# Build your Eleventy app
npx @11ty/eleventy

# Deploy it
bantam deploy _site

Quick Start

1

Install dependencies

Install Eleventy and project dependencies

npm install
2

Build your site

Generate static HTML from your templates

npx @11ty/eleventy
Creates the _site directory by default
3

Deploy with Bantam

Your Eleventy site is now live!

bantam deploy _site
Get an instant URL like https://my-11ty-site-abc123.bantam.site

Framework Details

Eleventy Configuration

Configure Eleventy for your project:

.eleventy.js:

module.exports = function(eleventyConfig) {
  // Copy static assets
  eleventyConfig.addPassthroughCopy("src/assets");
  eleventyConfig.addPassthroughCopy("src/css");
  
  // Watch CSS files for changes
  eleventyConfig.addWatchTarget("src/css/");
  
  // Add filters
  eleventyConfig.addFilter("dateDisplay", (dateObj) => {
    return new Date(dateObj).toLocaleDateString();
  });
  
  return {
    dir: {
      input: "src",
      output: "_site",
      includes: "_includes",
      layouts: "_layouts"
    },
    templateFormats: ["md", "njk", "html"],
    htmlTemplateEngine: "njk",
    markdownTemplateEngine: "njk"
  };
};
Eleventy is zero-config by default but highly customizable when needed.

Data Cascade

Use Eleventy's data cascade for dynamic content:

Global data file (_data/site.json):

{
  "name": "My Site",
  "url": "https://mysite.bantam.host",
  "description": "An Eleventy site"
}

Use in templates:

---
title: {{ site.name }}
---
<h1>{{ title }}</h1>
<meta property="og:url" content="{{ site.url }}{{ page.url }}">

Build Output

Eleventy generates files based on your input structure:

  • index.html - From index.md or index.njk
  • about/index.html - Clean URLs by default
  • blog/post-name/index.html - From markdown files
  • assets/ - Copied via passthrough
  • feed.xml - If configured with plugin
Eleventy preserves your directory structure while processing templates.

Advanced Usage

Custom Domain

Deploy directly to your own domain

bantam deploy ./dist --domain myapp.com

Permanent Deployment

Keep your site online forever (requires login)

bantam deploy ./dist --permanent

Custom Expiry

Set how long your deployment stays online

bantam deploy ./dist --expiry-days 7

Custom Subdomain

Choose your own subdomain on bantam.site

bantam deploy ./dist --subdomain my-project

CI/CD Integration

Add Bantam to your continuous deployment pipeline:

# GitHub Actions example
- name: Deploy to Bantam
  run: |
    npm install -g @bantamhq/cli
    bantam login --token ${{ secrets.BANTAM_TOKEN }}
    bantam deploy ./dist --domain myapp.com --permanent
Troubleshooting

Common Issues & Solutions

Quick fixes for deployment challenges

01.Template not found errors?

Check your template paths and extensions:

// .eleventy.js
return {
  dir: {
    input: "src",
    includes: "_includes", // Relative to input
    layouts: "_layouts"    // For layout templates
  },
  templateFormats: ["md", "njk", "html", "liquid"]
};

02.Assets not copying to output?

Add passthrough copy for static files:

// .eleventy.js
eleventyConfig.addPassthroughCopy("src/images");
eleventyConfig.addPassthroughCopy("src/css");
eleventyConfig.addPassthroughCopy("src/js");
eleventyConfig.addPassthroughCopy("src/favicon.ico");

// Or copy everything in assets
eleventyConfig.addPassthroughCopy("src/assets");

03.Data files not loading?

Ensure data files are in the correct location:

// Default data directory: _data/
src/
  _data/
    site.json     // Available as {{ site }}
    nav.js        // Can export functions
  posts/
    posts.json    // Directory data files

JavaScript data files can be dynamic:

// _data/build.js
module.exports = {
  timestamp: new Date(),
  env: process.env.NODE_ENV
};

04.Pagination not working?

Set up pagination in your template front matter:

---
pagination:
  data: collections.posts
  size: 10
  alias: posts
permalink: "/blog/page-{{ pagination.pageNumber + 1 }}/"
---

{% for post in posts %}
  <article>{{ post.data.title }}</article>
{% endfor %}

05.Build performance issues?

Optimize Eleventy builds:

// .eleventy.js
// Use incremental builds
eleventyConfig.setIncrementalBuild(true);

// Ignore files during serve
eleventyConfig.ignores.add("README.md");
eleventyConfig.ignores.add("node_modules/**/*");

// Set quiet mode for faster builds
eleventyConfig.setQuietMode(true);