Basildon

Basildon is a simple static website generator written in PHP and supporting Markdown content, Twig templates, SQLite, and outputs of HTML and PDF (via LaTeX).

Quick start

  1. mkdir mysite
  2. cd mysite
  3. composer require samwilson/basildon
  4. Add content and create templates (see below)
  5. ./vendor/bin/basildon .

Content

Content goes in the content/ directory, in whatever structure is required. Each file comprises two parts:

Read more about Content.

Templates

Templates are written in the Twig language, and can output to any format required. Usually HTML is the target format, but LaTeX, XML, or anything else is just as possible. Formats do have to have a file extension though (that's how they're identified, in Basildon).

All templates live in the templates/ directory of a site. The structure within that directory can be anything.

Read more about Templates.

Assets (stylesheets and scripts)

Every stylesheet and script in the assets/ directory will be copied to output/assets/.

Images should be in the content/ directory; for more information, see the Content documentation page.

Output

All output is in the output/ directory of a site. This directory is ready to be uploaded to a web server as the top level of the site.

The output/ directory is emptied on every run of Basildon. However, sometimes you need to be able to keep files or directories that persist. For example, you might want output/ to be its own Git repository for Github Pages, or to add a _redirects file for Netlify, or any number of other things. This is possible with the output_exclude config key, which takes an array of regular expressions to be matched against relative paths (these paths include the leading slash, similar to page IDs). For example:

output_exclude:
  - "|/_redirects|"
  - "|/\\.git.*|"