Skip to main content

build_manifest

Function build_manifest 

Source
pub fn build_manifest(
    content_dir: &Path,
    template_dir: &Path,
    site_dir: &Path,
) -> Result<Manifest, SsgError>
Expand description

Builds a Manifest by walking content_dir for .md files and pairing each with the layout templates it would render against.

The layout selection mirrors what the staticdatagen pipeline would do — templates/index.html and templates/page.html cover the 95% case. A page can override the cache policy via isr.s_maxage / isr.swr in frontmatter.

§Errors

Returns SsgError::Io when the content/template directories cannot be walked or read.

§Examples

use ssg::isr_manifest::build_manifest;
let tmp = tempfile::tempdir().unwrap();
let content = tmp.path().join("content");
let templates = tmp.path().join("templates");
let site = tmp.path().join("site");
std::fs::create_dir_all(&content).unwrap();
std::fs::create_dir_all(&templates).unwrap();
std::fs::create_dir_all(&site).unwrap();
let m = build_manifest(&content, &templates, &site).unwrap();
assert_eq!(m.len(), 0);