SSG

:= []

Static site generation effects: discover page sources, run application-defined decoders, optionally render Markdown, and write generated files to disk.

pages! : Path => Try(List(Page), [PagesError(Str), ..])

Find the markdown pages in the given directory, searched recursively.

pages_with! : { input_dir : Path, source_extension : Str } => Try(List(Page), [PagesError(Str), ..])

Find pages with source_extension in the given directory, searched recursively. The extension must not include a leading dot. Output paths always use .html.

decode_page! : Page, ({ page : Page, source : Str } => Try(value, [ReadError(Str), ..err])) => Try(value, [ReadError(Str), ..err])

Read a page source and run a pure or effectful decoder against it.

render_markdown! : { source_path : Path, markdown : Str } => Try(Str, [ParseError(Str), ..])

Render Markdown source to HTML. Replacement directives are resolved relative to source_path, which normally identifies the page being decoded.

write_file! : { output_dir : Path, output_path : Path, content : Str } => Try({  }, [WriteError(Str), ..])

Write content to output_path underneath output_dir, creating parent directories as needed.

Page : {
    url : Str,
    source_path : Path,
    output_path : Path,
}

A page source discovered under the input directory.

- source_path is the application-defined page source file. - output_path is relative to the output directory, with extension rewritten to .html. - url is the site-absolute URL of the output file.