![]() |
1 month ago | |
---|---|---|
src | 1 month ago | |
.gitignore | 1 month ago | |
LICENSE | 1 month ago | |
README.md | 1 month ago | |
build.js | 1 month ago | |
package-lock.json | 1 month ago | |
package.json | 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 extensionsource
the path of the original file, a stringextension
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 propertiessort
Sort matched documents by the expressiongroup
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.