Ten will be / is a static site generator / content management system / web framework solution. I created it because:
- I want my website code to last for decades
- Frameworks like Hugo, Zola, etc. will eventually go the way of Jekyll
- Migrating working code is a waste of time
- It's easier to implement bespoke features
- I have a lot of cool ideas that use knowledge tools
- on watch mode:
- it's VERY useful for debugging output
- it felt slow and bad because i was using it with browser-sync to serve the generated contents
- it should now be "re-added" (without browser-sync), and everything will make sense
- Blog RSS feed and fix tags/categories in dev server
- Be able to build only certain files/directory matching a glob
- later: Linter to always ensure trailing slash for local URLs
- Summary
- Content Files
- Website JavaScript Customization
- Page JavaScript Customization
- Directory Structure
- Older Ideas
Ten is a static site generator. Conventionally, it recursively reads input files from content/
. Then, it processes each file path and content. Finally, it writes the result path and content to build/
.
Content files are any files located in the content directory that aren't special.
Transformations are done to file paths in two cases:
- If a file ends with
.md
(or similar) files, it is converted into a.html
file.
/mathematics.md
->/mathematics.html
/index.md
->/index.html
- If a file name (excluding file extensions) is the same as the directory name of it's parent directory, then that file is renamed to
index.html
.
/about/about.md
->/about/index.html
This makes it easier to edit files in IDEs (unlike Next.js's page.js
).
The following formats are supported:
These are processed with the templating engine Handlebars.
Templates have access to the following variables:
Page
(layouts & partials, pages)Title
(layouts & partials, pages)Body
(layouts & partials)
Markdown files support the following features:
- Syntax highlighting (via Shiki)
- Emoji conversion
- KaTeX
Special file modify behavior and are not processed. They include:
*.ten.js
Described further in JavaScript Customization
_*
These are ignored.
*_
These are ignored.
This file potentially customizes the behavior of the whole website. To be recognized, its name must be /ten.config.js
.
It can export:
defaults
transformUri()
decideLayout()
validateFrontmatter()
handlebearsHelpers
tenHelpers
This file potentially customizes the behavior of a single page. To be recognized, its name must match /**/<adjacentFileName>.ten.js
.
It can export:
Meta()
Head()
GenerateSlugMapping()
GenerateTemplateVariables()
Nothing here is out of the ordinary.
Where output files are written to.
User-generated content. There are several variants:
Handlebars templates that are applied to all pages and posts. Individual pages and posts can specify a particular template in the frontmatter using the layout
property.
Handlebars partials that can be used in any HTML file.
These assets are copied directly to the build directory without processing.
Entrypoints. Entrypoints were created to make it easier to approximate tracking dependencies of a page. For example, if /math/theme.cls
changed, then probably /math/slides.tex
should be regenerated as well. This breaks down too often, as it's not uncommon for files under a particular directory to be unrelated. An alternative to entrypoints was tracking dependencies of a page by parsing the page with either regular expressions or a laguage parser library. This wasn't chosen since it would mean adding regular expressions or traverse functions for each markup language. And, detection would not be posssible with more dynamic markup languages.