StaticBlog.Generator (StaticBlog v0.2.0)

Copy Markdown View Source

Static site generator. Walks the compiled list of posts and writes a self-contained website into the output directory (defaults to _site/).

Summary

Functions

build(output_dir \\ "_site", posts \\ nil)

@spec build(Path.t(), [StaticBlog.Post.t()] | nil) :: {:ok, map()}

Build the static site.

Arguments

  • output_dir is the directory to write into. It is deleted and recreated. Defaults to "_site" in the current working directory.

  • posts is an optional list of posts. When nil, posts are read from disk via StaticBlog.RuntimePosts.all/0.

Returns

  • {:ok, %{files: non_neg_integer(), bytes: non_neg_integer(), output: Path.t()}} with counts of the files written and their total size.