class pathlib.Path)

Bases: object

Configuration of main site.

emit(event: str) → None

Emit a named event to all registered callbacks.

get_context(obj: gilbert.content.Page, **kwargs) → stencil.Context

Build a template context object.

Applies all registered context generators.


Create a new site root.

Ensures the template, pages, content, and destination directories for this site exist, creating them if they don’t. Creates an skeleton config.yml file.


Builds the ‘content’ collection for this site, loading all content.


Builds the ‘pages’ collection for this site, loading all content.

load_plugin(package_name: str) → bool

Helper function for importing a plugin and handling its initialisation.


Loads all configured plugins, as well as the site-local `, if found.

on(event: str, handler: Callable[[Site], None]) → None

Registers a callback function for a given event.

classmethod register_context_provider(func: Callable[[dict], dict])

Adds a new context provider to the Site.

Context Providers are applied every time a render needs a template context.

classmethod register_loader(ext: str, func: Callable[[pathlib.Path], Tuple[Union[None, ByteString, str], Dict[KT, VT]]])

Register a file type loader by extension.


Loads all content and pages, then renders the site.


Render all pages in this site.

class str)

Bases: object

Method decorator to cause a method to emit before- and after- events.