arctic/page

Functions

pub fn new(id: String) -> Page

Construct a new page, with the given ID and default-everything.

pub fn replace_metadata(
  p: Page,
  metadata: Dict(String, String),
) -> Page

Swap out the entirety of the metadata for a page with a new dictionary, except for the privileged metadata like .title and .date. This is useful for if you’re building a metadata dictionary programmatically.

pub fn with_blerb(p: Page, blerb: String) -> Page

Add a blerb (description, whatever) to a page. This is useful for nice thumbnails.

pub fn with_body(p: Page, body: List(Element(Nil))) -> Page

Add a “body” to a page. A body is the list of elements that will appear when the page is loaded.

pub fn with_date(p: Page, date: Time) -> Page

Add a date to a page. This is useful for sorting pages by date in a list, like in a blog.

pub fn with_metadata(p: Page, key: String, val: String) -> Page

Add some metadata to a page. This is any string key and value, that you can look up during parsing later. Sorry for the lack of type safety! Processing mismatches are handled with snag results, which is like compile-time errors since the run-time is at build-time. Also, note that some metadata gets privileged fields store in a different way, like .date. This adds type safety and convenience, and is opt-in.

pub fn with_tags(p: Page, tags: List(String)) -> Page

Add tags to a page. This is useful for implementing a helpful search.

pub fn with_title(p: Page, title: String) -> Page

Add a title to a page.

Search Document