CHGenerator/WebsiteGenerator/Content/LinkPreviewMetadata.swift
Christoph Hagen 14b935249f First version
2022-08-16 10:39:05 +02:00

42 lines
1.1 KiB
Swift

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.
If `nil` is specified, then the localized element title is used.
*/
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.
- 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.
*/
let description: String?
}
extension LinkPreviewMetadata: Codable { }
extension LinkPreviewMetadata {
static var initial: LinkPreviewMetadata {
.init(title: nil,
image: nil,
description: "The page description for link previews")
}
}