Lume Static Site Generator

website·Indexed 34 days ago

https://lume.land/

A static site generator built for Deno. Lume features a plugin system, support for MDX, and integrates with Vento as its default template engine. It includes a companion CMS called LumeCMS and a dedicated CLI for site management. Recent versions include support for EPUB generation, native Temporal API support, and a variety of plugins for image transformation, routing, and SEO.

Tokens
99.7K
Snippets
717
Records
848
Agent score
71%

What's inside Lume

  1. Overview of LumeCMS architecture

    LumeCMS is a CMS designed to be agnostic of the site generator used. It is built around five core concepts:

    • Storage: Abstractions for reading/writing data from file systems, databases, or APIs.
    • Documents: Individual pages or entities (e.g., a homepage).
    • Collections: Groups of documents sharing the same data structure (e.g., blog posts).
    • Uploads: Folders for binary files like images, videos, and PDFs.
    • Fields: Value types and their corresponding UI editors (e.g., 'text' maps to an <input type="text">).
  2. Overview of Lume Static Site Generator

    Lume is a static site generator built for Deno. It is designed to be a flexible and easy-to-configure alternative to generators like Jekyll, Hugo, or Eleventy. Key features include:

    • Multi-format support: Native support for Markdown, YAML, JavaScript, TypeScript, JSX, Vento, and Nunjucks, with the ability to extend to more formats.
    • Processor Pipeline: Ability to hook processors to manipulate HTML and assets (such as CSS or JS).
    • Deno-native: Eliminates the need for node_modules or complex bundlers by downloading only necessary dependencies.
  3. Overview of Lume Modules plugin

    The Modules plugin allows developers to use JavaScript and TypeScript to create pages, layouts, and data files in Lume. Because Lume is built on Deno, it provides native support for these modules. This plugin is installed by default.
  4. Overview of the Lume EPUB plugin

    The EPUB plugin converts a Lume site into the standard EPUB ebook format. It handles the creation of required manifest files (container.xml, encryption.xml, mimetype, and content.opf), generates the toc.ncx structure using the nav plugin, converts .html pages to .xhtml, and compresses the final output into a book.epub file in the dest folder.
  5. Overview of the Lume JSON plugin

    The JSON plugin allows developers to create pages and store data using the JSON format. Starting from Lume version 1.18.0, JSONC (JSON with comments) is also supported.
  6. Use multiple template engines in Lume

    Lume supports a wide variety of template engines for creating pages, including Markdown, Vento, Nunjucks, Liquid, JSX, TSX, JavaScript, TypeScript, Pug, Eta, and others. Users can also easily add their own custom engines.
    // Example using JSX
    export default function ({ title, items }) {
      return <>
        <h1>{ title }</h1>
        <ul>
          { items.map((item) => <li>{ item }</li>)}
        </ul>
      </>;
    }
  7. Dependency resolution in Lume 3 esbuild plugin

    The esbuild plugin in Lume 3 now uses esbuild-deno-loader instead of delegating to esm.sh. This change provides more reliable bundled code and better compatibility with Deno's complex module resolution (including HTTP, NPM, and JSR packages).
  8. Configure Pretty URLs in Lume

    By default, Lume uses 'pretty URLs', meaning it removes the .html extension from URLs by saving files as index.html within a directory (e.g., /about-us.html becomes /about-us/). To disable this behavior and use standard .html filenames, set prettyUrls to false in the Lume configuration file.
    // In the config file
    export default {
      prettyUrls: false,
    }
  9. Use the Lume reload middleware for live-reloading

    The reload middleware implements live-reload in the browser automatically after files are changed. This functionality is intended for local development and is enabled by default when running Lume in --serve mode.
  10. Redirect between www and non-www domains using Lume middleware

    The www middleware redirects requests from www. domains to naked (non-www) domains, or vice versa. This middleware requires Lume's HTTP Server and must be hosted on a Deno server (such as Deno Deploy) for production use.
  11. Fix absolute paths for subdirectory hosting with the base_path plugin

    The base_path plugin automatically fixes absolute paths in HTML and CSS files by prepending the pathname defined in the site's location configuration. This is essential for sites hosted in a subdirectory to ensure links and assets resolve correctly.

    • HTML: The plugin scans for href, src, srcset, and imagesrcset attributes.
    • CSS: The plugin fixes @import and url() declarations that point to local files.
  12. LumeCMS Router Migration to Galo

    LumeCMS has migrated from Hono to Galo, a minimalist router that embraces web standards. This change transforms LumeCMS into a middleware that can be embedded in any Deno application without side effects or interference with existing code.