class

Kamil::Generator::SiteEmitter

Inherits Reference < Object

[FUNC-006] [TECH-006] Clean URL Static Site and Feed Emitter Compiles indexed content documents and static assets into a production-ready static HTML directory structure with clean URL hierarchy.

Constructors

new(content_dir : Path | String = Path.new("content"), layouts_dir : Path | String = Path.new("layouts"), static_dir : Path | String = Path.new("static"), output_dir : Path | String = Path.new("public"), store : Persistence::IndexStore = Persistence::SqliteStore.new, parser : Content::FormatParser = Content::MarkdParser.new, resolver : Content::Pipeline::LayoutResolver | Nil = nil, clean : Bool = false, base_url : String = "", dev_mode : Bool = false, options : GeneratorOptions | Nil = nil)

Standard configurable constructor with default dependencies.

Source
new(store : Persistence::IndexStore, parser : Content::FormatParser, resolver : Content::Pipeline::LayoutResolver, options : GeneratorOptions = GeneratorOptions.new, content_dir : Path | String = Path.new("content"), layouts_dir : Path | String = Path.new("layouts"), static_dir : Path | String = Path.new("static"))

Alternative constructor supporting dependency injection order.

Source

Instance methods

base_url
Source
build_all(clean : Bool = @clean) : Int32

Standard build entry point returning total emitted page count.

Source
clean

Alias for non-predicate getter.

Source
clean?
Source
content_dir
Source
copy_static_assets

Synchronizes static assets into the output directory.

Source
dev_mode

Alias for non-predicate getter.

Source
dev_mode?
Source
emit_all(clean : Bool = @clean) : EmitStats

Compiles all eligible published documents and copies static assets. Returns EmitStats with emitted page count and static asset count.

Source
generate_atom_feed(published_docs : Array(Kamil::Document), feed_title : String = "Site Feed") : String

Generates standard Atom feed.xml content from a list of published documents.

Source
generate_sitemap(published_docs : Array(Kamil::Document)) : String

Generates standard sitemap.xml content from a list of published documents.

Source
layouts_dir
Source
options
Source
output_dir
Source
output_path_for(doc : Kamil::Document) : Path

Resolves the clean URL disk destination path for a Document entity.

Source
output_path_for(relative_path : String | Path) : Path

Resolves the clean URL disk destination path for a given source relative path. Rules:

  1. Root index (index.md, index.html) -> output_dir/index.html
  2. Section index (posts/index.md) -> output_dir/posts/index.html
  3. Standard document (about.md) -> output_dir/about/index.html
  4. Nested document (posts/hello.md) -> output_dir/posts/hello/index.html
  5. Deep document (docs/api/v1/auth.md) -> output_dir/docs/api/v1/auth/index.html
Source
parser
Source
prune_output_for(relative_path : String | Path) : Nil

Removes compiled HTML artifact in output directory corresponding to a deleted content source file.

Source
prune_static_asset(relative_path : String | Path) : Nil

Removes a static asset from output directory corresponding to a deleted static file.

Source
purge_output_dir

Completely purges the output directory and recreates an empty directory.

Source
resolver
Source
static_dir
Source
store
Source