scriptorium/paths
Path configuration controls where files are generated and how links are formed.
Types
The path configuration controls where files will be located and where links will point to.
pub type PathConfiguration {
PathConfiguration(
root: String,
index: String,
single_post: fn(post.Post) -> String,
page: fn(page.Page) -> String,
tag: fn(String) -> String,
year: fn(Int) -> String,
month: fn(Int, date.Month) -> String,
list_page: fn(String, Int) -> String,
html: fn(String) -> String,
feed: String,
feed_file: String,
)
}
Constructors
-
PathConfiguration( root: String, index: String, single_post: fn(post.Post) -> String, page: fn(page.Page) -> String, tag: fn(String) -> String, year: fn(Int) -> String, month: fn(Int, date.Month) -> String, list_page: fn(String, Int) -> String, html: fn(String) -> String, feed: String, feed_file: String, )
Arguments
- root
-
The root path where the blog will be accessible. With starting slash but without trailing slash, e.g.
/scriptorium_blog
. Note that if the blog is accessible without a subpath, this value should be""
. - index
-
The index path. Note that the first page of the index is always written into
"/"
, meaningindex.html
. This path is used for the rest of the pages, e.g."/wibble"
would result in/wibble/2.html
,/wibble/3.html
and so on. - single_post
-
Path to a single post.
- page
-
Path to a page.
- tag
-
Path to a tag archive.
- year
-
Path to a year archive.
- month
-
Path to a month archive of a given year.
- list_page
-
List page path: given the original path such as
/tag/wibble
as a string and the page number, forms the final path. - html
-
HTML path: Append (or don’t) the
.html
extension to the given path. If you are using fancy URLs without extensions, override this to do nothing. - feed
-
Path to the feed as it is accessible from the browser.
- feed_file
-
Path and file name of the feed file that will be written, without the file extension! E.g.
/feed
will create a file/feed.xml
.
Values
pub const default_feed: String
The default path where the feed is accessible when hosted.
pub const default_feed_file: String
The default filename where the feed is written.
pub fn default_list_page(path: String, page: Int) -> String
Get the given list path with a page number.
The first page does not get any appended page number.
pub fn default_month_archive(
year: Int,
month: date.Month,
) -> String
Month archive path in the format /archive/2024/05
.
pub fn default_single_post(post: post.Post) -> String
Post path in the format /2024/12/31/slug
.
pub fn default_year_archive(year: Int) -> String
Year archive path in the format /archive/2024
.