2022-08-16 10:39:05 +02:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
/**
|
|
|
|
Localized configuration data for link previews of site elements.
|
|
|
|
|
|
|
|
This struct is embedded in localized metadata and intended to be filled in the JSON source.
|
|
|
|
*/
|
|
|
|
struct LinkPreviewMetadata {
|
|
|
|
|
|
|
|
/**
|
|
|
|
The title to use for the link preview.
|
|
|
|
|
2022-08-19 18:05:06 +02:00
|
|
|
If `nil` is specified, then the localized element `title` is used.
|
2022-08-16 10:39:05 +02:00
|
|
|
*/
|
|
|
|
let title: String?
|
|
|
|
|
|
|
|
/**
|
|
|
|
The file name of the link preview image.
|
|
|
|
- Note: The image must be located in the element folder.
|
|
|
|
- Note: If `nil` is specified, then the (localized) thumbnail is used.
|
|
|
|
*/
|
|
|
|
let image: String?
|
|
|
|
|
|
|
|
/**
|
|
|
|
The description text for the link preview.
|
2022-08-19 18:05:06 +02:00
|
|
|
- Note: If `nil` is specified, then first the (localized) element `subtitle` is used.
|
|
|
|
If this is `nil` too, then the localized `description` of the element is used.
|
2022-08-16 10:39:05 +02:00
|
|
|
*/
|
|
|
|
let description: String?
|
|
|
|
}
|
|
|
|
|
|
|
|
extension LinkPreviewMetadata: Codable { }
|
|
|
|
|
|
|
|
extension LinkPreviewMetadata {
|
|
|
|
|
|
|
|
static var initial: LinkPreviewMetadata {
|
|
|
|
.init(title: nil,
|
|
|
|
image: nil,
|
|
|
|
description: "The page description for link previews")
|
|
|
|
}
|
|
|
|
}
|