scriptorium/rendering/views

Types

The base view renders the base page layout.

The three arguments are:

  • The inner content to render in the layout.
  • Extra elements to put inside <head>.
  • Text to add as a prefix to the <title> element.
pub type BaseView =
  fn(Element(Nil), List(Element(Nil)), String) -> Element(Nil)

View to render the RSS or Atom feed.

pub type FeedView =
  fn(List(CompiledPost)) -> Element(Nil)

Information passed for list pages.

pub type ListInfo {
  ListInfo(
    root_path: String,
    current_page: Int,
    total_pages: Int,
    posts: List(CompiledPost),
    extra_header: Element(Nil),
  )
}

Constructors

  • ListInfo(
      root_path: String,
      current_page: Int,
      total_pages: Int,
      posts: List(CompiledPost),
      extra_header: Element(Nil),
    )

    Arguments

    • root_path

      The path to prefix before the page number. E.g. /index and the resulting path would then be /index/2.

    • current_page

      The page number of the current page being rendered.

    • total_pages

      The amount of pages in the current list.

    • posts

      Posts on this page.

    • extra_header

      Any extra content to put on top of the page before the posts.

View to render a list page. A list page is a page with many posts in a list.

pub type ListPageView =
  fn(ListInfo) -> Element(Nil)

The meta view renders meta tags such as OpenGraph based on the page information.

pub type MetaView =
  fn(PageType) -> List(Element(Nil))

Types of pages in the blog.

pub type PageType {
  Post(post.Post)
  Page(page.Page)
  Other(title: String, description: String)
}

Constructors

  • Post(post.Post)

    Individual post.

  • Page(page.Page)

    Individual page.

  • Other(title: String, description: String)

    Any other page.

View to render an individual page.

pub type PageView =
  fn(CompiledPage) -> Element(Nil)

View to render an individual post.

pub type SinglePostView =
  fn(CompiledPost) -> Element(Nil)
Search Document