scriptorium/models/post
A post in the blog.
Types
pub type Post {
Post(
title: String,
slug: String,
tags: List(String),
headers: List(#(String, String)),
content: String,
short_content: option.Option(String),
date: PostedAt,
order: Int,
)
}
Constructors
-
Post( title: String, slug: String, tags: List(String), headers: List(#(String, String)), content: String, short_content: option.Option(String), date: PostedAt, order: Int, )
Arguments
- short_content
-
The content before the split, if any
- order
-
The post’s order during that day, if there are multiple posts on the same day.
pub type PostedAt {
JustDate(date.Date)
DateTime(
date: date.Date,
time: time.Time,
tz: String,
luxon: luxon.DateTime,
)
}
Constructors
-
JustDate(date.Date)
The post only had date information.
-
DateTime( date: date.Date, time: time.Time, tz: String, luxon: luxon.DateTime, )
The post had date, time, and timezone information.
Values
pub fn comparator(a: Post, b: Post) -> order.Order
Compare two posts and get an order between them.
pub fn get_luxon(post: Post) -> option.Option(luxon.DateTime)
Get the Luxon datetime of the post, if it exists.
pub fn get_time(post: Post) -> option.Option(time.Time)
Get the time of the post, if it exists.
pub fn to_iso8601(post: Post) -> String
Get the post’s date or datetime formatted as an ISO 8601 formatted string.