Skip to main content

get_collection

Function get_collection 

Source
pub fn get_collection<T: DeserializeOwned>(
    dir: impl AsRef<Path>,
) -> Result<Vec<Entry<T>>>
Expand description

Loads every Markdown file under dir whose frontmatter matches T. Returns entries sorted by slug.

§Errors

  • Returns the first I/O error encountered while walking the directory.
  • Returns the first frontmatter deserialisation error, with the failing path in the error chain (anyhow::Error::context).

Files without a frontmatter delimiter are silently skipped — the collection is for structured content, and pages without frontmatter aren’t part of the schema.

§Determinism

Output is sorted by Entry::slug (lexicographic). Callers that hash collections for golden tests or fingerprinting benefit directly.