Wedding myself to a third-party static site generator solution limits the degree to which I can customize my website. Ten solves that because it's my software.
- Blog RSS feed and fix tags/categories in dev server
- Be able to build only certain files/directory matching a glob
- later: treat entrypoint and non-entrypoint the same
- fix "XML" file being an entrypoint. ie, all files should be able to be procesed with a ".ten.js" file.
- later: Make
FileList
aDirList
(later) - later: Linter to always ensure trailing slash for local URLs
Ten is a static site generator. Conventionally, it reads input files from content/
; for each file, it is processed, then written to build/
. When processing each file, it transforms both its path and content.
When walking the content directory, every directory is associated with either a route or file. For each directory, there are two possible types of files: Entrypoint and non-entrypoint files.
These are similar to index.html
when serving files over the web, or page.js
in a Next.js project. They define the content generated at a particular route. There are three way to define one:
/content/index.html
->/build/index.html
/content/about/about.md
->/build/about/index.html
/content/index.html/index.html
->/build/index.html
The first way is required. The second way makes it easier to edit files in IDEs. The third way makes it easier to differently group files that are all under the same route.
The following formats are supported:
These are processed with the templating engine Handlebars.
Markdown files support the following features:
- Syntax highlighting (via Shiki)
- Emoji conversion
- KaTeX
TODO: Fix this
These files are files associated with the entrypoint. They are copied to their respective output directory, unless the file matches:
*.ten.js
_*
*_
Meta()
Header()
GenerateSlugMapping()
GenerateTemplateVariables()
Nothing here is out of the ordinary.
Where output files are written to.
User-generated content. There are several variants:
Contains directories and files that each represent an individual page. For example, the directory /pages/about
represents /about/index.html
while the file pages/index.xml
represents /index.xml
.
Contains subdirectories with a dirname of either (1) a year (ex. 2005
) or (2) the value drafts
. The subdirectories of those subdirectories represent an individual page (ex. posts/2023/oppenheimer-movie-review
). Drafts are automatically shown when running the development server and automatically hidden when building the blog, unless indicated otherwise by the --show-drafts
command-line flag.
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.