Class
Item
class Item<M> where M : MetadataA model representing an item.
An item can be any text file (like a Markdown or RestructedText file). Readers will turn the file into an Item, and Writers will turn the Item into a String (for example HTML or RSS) to be written to disk.
Mentioned In
Initializers
init(
absoluteSource: Path,
relativeSource: Path,
relativeDestination: Path,
title: String,
body: String,
date: Date,
created: Date,
lastModified: Date,
metadata: M
)convenience init(
title: String,
body: String = "",
date: Date = Date(),
relativeDestination: Path? = nil,
metadata: M
)Create an Item programmatically (without reading from a file).
Parameters
titleThe title of the item.
bodyThe body content. Defaults to an empty string.
dateThe date of the item. Defaults to the current date.
relativeDestinationThe output path relative to the site's output folder. Defaults to
title-slug/index.html.metadataThe parsed metadata.
Instance Properties
let absoluteSource: PathThe absolute path of the file
var body: StringThe body of the file, without the metadata header, and without the first title.
let created: DateThe creation date of the item. Please note that this value can be inconsistent when cloning or pulling from git, see https://github.com/loopwerk/Saga/issues/21.
var date: DateThe date of the item. Will be taken from the metadata if available, defaults to the creation date otherwise. Please note that the creation date value can be inconsistent when cloning or pulling from git, see https://github.com/loopwerk/Saga/issues/21.
var filenameWithoutExtension: String { get }let lastModified: DateThe last modified date of the item. Please note that this value can be inconsistent when cloning or pulling from git, see https://github.com/loopwerk/Saga/issues/21.
var metadata: MThe parsed metadata. Metadata can be any Codable object.
var relativeDestination: PathThe destination, where the Writer will write it to disk.
let relativeSource: PathThe path of the file, relative to the site’s input.
var title: StringThe title of the item.
var url: String { get }Relationships
Conforms To
AnyItem , Swift.Sendable