Module Memoir_lib

Shared library for the Memoir generator and dev server: filesystem helpers plus RSS-feed loading and rendering. The processed-page model is the single canonical Content_types.content_page.

type config = {
  1. site_title : string;
  2. site_description : string;
  3. author : string;
  4. base_url : string;
  5. output_dir : string;
  6. content_dir : string;
}

Site configuration: RSS metadata plus the build paths both executables share.

val default_config : config

The single canonical site configuration used by the generator and server.

val site_domain : string

Canonical public domain of the site, used to build absolute URLs.

val read_file : string -> string

Binary-safe read of an entire file; raises Failure on IO error.

val write_file : string -> string -> unit

Binary-safe write, creating parent directories as needed; raises Failure on IO error.

val ensure_directory_exists : string -> unit

Create a directory and any missing parents.

val load_rss_pages : content_dir:string -> Content_types.content_page list

Load blog and journal posts (excluding index.md) as content pages, with each page's url_path set to its section URL. Ordering/limiting is left to generate_rss_feed.

val generate_rss_feed : Content_types.content_page list -> config -> string

Render an RSS 2.0 feed: drop drafts, sort newest-first, keep the 20 most recent items.