scriptorium/models/post
A post in the blog.
Types
pub type Post {
Post(
title: String,
slug: String,
tags: List(Tag),
headers: List(Header),
content: String,
short_content: Option(String),
date: PostedAt,
order: Int,
)
}
Constructors
-
Post( title: String, slug: String, tags: List(Tag), headers: List(Header), content: String, short_content: 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)
DateTime(date: Date, time: Time, tz: String, luxon: DateTime)
}
Constructors
-
JustDate(Date)
The post only had date information.
-
DateTime(date: Date, time: Time, tz: String, luxon: DateTime)
The post had date, time, and timezone information.
Functions
pub fn comparator(a: Post, b: Post) -> Order
Compare two posts and get an order between them.
pub fn get_luxon(post: Post) -> Option(DateTime)
Get the Luxon datetime 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.