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(@internal Element(Nil), List(@internal Element(Nil)), String) -> @internal Element(
Nil,
)
View to render the RSS or Atom feed.
pub type FeedView =
fn(List(compiler.CompiledPost)) -> @internal Element(Nil)
Information passed for list pages.
pub type ListInfo {
ListInfo(
root_path: String,
current_page: Int,
total_pages: Int,
posts: List(compiler.CompiledPost),
extra_header: @internal Element(Nil),
)
}
Constructors
-
ListInfo( root_path: String, current_page: Int, total_pages: Int, posts: List(compiler.CompiledPost), extra_header: @internal 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) -> @internal Element(Nil)
The meta view renders meta tags such as OpenGraph based on the page information.
pub type MetaView =
fn(PageType) -> List(@internal Element(Nil))
View to render an individual page.
pub type PageView =
fn(compiler.CompiledPage) -> @internal Element(Nil)
View to render an individual post.
pub type SinglePostView =
fn(compiler.CompiledPost) -> @internal Element(Nil)