63 lines
1.3 KiB
Swift
63 lines
1.3 KiB
Swift
|
import Foundation
|
||
|
|
||
|
extension Page {
|
||
|
|
||
|
struct LocalizedMetadata {
|
||
|
|
||
|
let id: String
|
||
|
|
||
|
let title: String
|
||
|
|
||
|
#warning("Generate title suffix")
|
||
|
let titleSuffix: String?
|
||
|
|
||
|
let linkPreview: LinkPreviewMetadata?
|
||
|
|
||
|
let subtitle: String?
|
||
|
|
||
|
#warning("Generate thumbnail suffix")
|
||
|
let thumbnailSuffix: String?
|
||
|
|
||
|
let cornerText: String?
|
||
|
|
||
|
/**
|
||
|
The external url to use instead of automatically generating the page.
|
||
|
|
||
|
This property can be used for links to other parts of the site, like additional services.
|
||
|
It can also be set to manually write a page.
|
||
|
*/
|
||
|
let externalUrl: String?
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
extension Page.LocalizedMetadata: Codable {
|
||
|
|
||
|
}
|
||
|
|
||
|
extension Page.LocalizedMetadata: LanguageIdentifiable {
|
||
|
|
||
|
var languageIdentifier: String {
|
||
|
id
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Page.LocalizedMetadata {
|
||
|
|
||
|
static var initial: Page.LocalizedMetadata {
|
||
|
.init(id: "en",
|
||
|
title: "Page title",
|
||
|
titleSuffix: nil,
|
||
|
linkPreview: .initial,
|
||
|
subtitle: "Some text below the title",
|
||
|
thumbnailSuffix: "Project",
|
||
|
cornerText: nil,
|
||
|
externalUrl: nil)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Page.LocalizedMetadata: LinkPreviewMetadataProvider {
|
||
|
|
||
|
var description: String { subtitle ?? title }
|
||
|
}
|