Simple static site generator. Yes, another one.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Ramsey Nasser 11eafe8d36 Update README 1 month ago
src Add missing files 1 month ago
.gitignore Add missing files 1 month ago
LICENSE Add missing files 1 month ago
README.md Update README 1 month ago
build.js Include src in npm package 1 month ago
package-lock.json Rename to intaj 1 month ago
package.json Include src in npm package 1 month ago

README.md

intaj

A simple static site generator. Yes, another one, if you can believe it.

Status

Very new and subject to change. intaj is being built primarily to meet my own needs and the needs of my cooperative. Use at your own risk -- but have fun with it!

Open to feedback too if you are using it -- ping me on Mastodon!

Usage

intaj generates sites by querying a folder full of markdown files to generate pages.

Installation

npm install -g intaj
cd path/to/site
intaj watch # live server at localhost:8900
intaj build # build site to `./out` folder

Configuration

To change defaults, write a intaj.yaml file in the directory you run the intaj command. Default values are:

data: './site'          # directory of site files  
pages: './pages'        # directory of site pages
helpers: './helpers'    # directory of .js helper modules
partials: './partials'  # directory of .hbs partials files
output: './out'         # directory to write generated site
port: 8900              # port to serve intaj watch
markdown: {}            # options to pass to the markdown parser

Files

Write markdown files with YAML front matter into a site directory. You can organize them however you like.

intaj automatically adds the following properties to the front matter of all files:

  • path the path to the file, an array of strings of directories and the final filename without an extension
  • source the path of the original file, a string
  • extension the extensio of the original file, a string

You can place other files here as well, like images, videos, CSS files etc. They will be copied verbatim into the output directory, preserving their folder structure. Markdown files will be treated specially and rendered through Pages. Markdown content has access to all Handlebars partials and helpers.

Pages

Write Handlebars templates with YAML front matter into a pages directory. The front matter consists of two properties:

  • query: Optional, a list of query operations to filter and transform your files into a matching set of documents. The page will be rendered once for each matching document. See below for query documentation.

    If absent the page will be rendered exactly once with an empty document.

  • route: Required, The path in the output directory to write the resulting file. It will be rendered as a Handlebars template with the matching document as input.

The body of the page is a Handlebars template that will be rendered with the matching document as input. It has access to all the front matter of the document and the body of the document as the content property.

Queries

intaj includes its own custom declarative query language inspired by MongoDB aggregation pipelines, but intended to be more readable and more focused on the task of site generation. They are run in order, each operator acting on the set of documents produced by the previous operator.

Operators use snippets of JavaScript code. This code is run in the context of documents being operated on and has direct unqualified access to all their properties.

Current supported operators are:

  • filter Reduce the set of documents to those that match.
  • with Add properties to each matched document, computing them from existing properties
  • sort Sort matched documents by the expression
  • group Group matched documents by the result of the expression. Results in a single document.
  • collect Collect matched documents under a property of a single document.

Partials

injaj supports Handlebars Partials. Write .hbs files into the ./partials directory and they will be loaded automatically and made available to your templates via their filenames.

Helpers

intaj supports Handlebars Helpers. Write .js files into the ./helpers directory and they will be loaded automatically as JavaScript modules. Any named exports will be made available to your templates. Exported functions will be useable as helpers ({{helper x y z}} syntax) and exported strings will be available as partials ({{> partial}} syntax).

License

Copyright © 2025 Ramsey Nasser. Provided under the ACSL.