arctic
Types
A particular organization of pages,
written either in custom markup or raw HTML.
A collection might be a set of products, or blog posts, or wiki entries.
A dedicated page can be generated to show off the pages in a collection,
and RSS feeds and whatnot can also be generated from the set of pages.
The pages are pulled from a particular directory,
and parsed and rendered a particular way,
that might be different from other collections.
See arctic/collection
for more.
pub type Collection {
Collection(
directory: String,
parse: fn(String, String) -> Result(Page, snag.Snag),
index: option.Option(
fn(List(CacheablePage)) -> @internal Element(Nil),
),
feed: option.Option(
#(String, fn(List(CacheablePage)) -> String),
),
ordering: fn(Page, Page) -> order.Order,
render: fn(Page) -> @internal Element(Nil),
raw_pages: List(RawPage),
)
}
Constructors
-
Collection( directory: String, parse: fn(String, String) -> Result(Page, snag.Snag), index: option.Option( fn(List(CacheablePage)) -> @internal Element(Nil), ), feed: option.Option( #(String, fn(List(CacheablePage)) -> String), ), ordering: fn(Page, Page) -> order.Order, render: fn(Page) -> @internal Element(Nil), raw_pages: List(RawPage), )
An Arctic configuration, describing all the collections, pages, parsing rules, etc.
pub type Config {
Config(
render_home: fn(List(ProcessedCollection)) -> @internal Element(
Nil,
),
main_pages: List(RawPage),
collections: List(Collection),
render_spa: option.Option(
fn(@internal Element(Nil)) -> @internal Element(Nil),
),
)
}
Constructors
-
Config( render_home: fn(List(ProcessedCollection)) -> @internal Element( Nil, ), main_pages: List(RawPage), collections: List(Collection), render_spa: option.Option( fn(@internal Element(Nil)) -> @internal Element(Nil), ), )
A single page in a collection.
These must have an ID to distinguish from other pages in the collection,
and a body of HTML elements.
Any other metadata can be added (stringly typed),
and there are a variety of privileged metadata fields
like .title
and .date
that are actual typed properties.
However, these fields are optional.
See arctic/page
for more.
pub type Page {
Page(
id: String,
body: List(@internal Element(Nil)),
metadata: dict.Dict(String, String),
title: String,
blerb: String,
tags: List(String),
date: option.Option(timestamp.Timestamp),
)
}
Constructors
-
Page( id: String, body: List(@internal Element(Nil)), metadata: dict.Dict(String, String), title: String, blerb: String, tags: List(String), date: option.Option(timestamp.Timestamp), )
A collection whose pages have been processed from the files.
pub type ProcessedCollection {
ProcessedCollection(
collection: Collection,
pages: List(CacheablePage),
)
}
Constructors
-
ProcessedCollection( collection: Collection, pages: List(CacheablePage), )
Values
pub fn date_to_string(ts: timestamp.Timestamp) -> String
pub fn get_id(p: CacheablePage) -> String
pub fn output_path(input_path: String) -> String
pub fn parse_date(
date: String,
) -> Result(timestamp.Timestamp, snag.Snag)
pub fn to_dummy_page(c: CacheablePage) -> Page