CHGenerator/WebsiteGenerator/Content/Section+LocalizedMetadata.swift

66 lines
1.5 KiB
Swift
Raw Normal View History

2022-08-16 10:39:05 +02:00
import Foundation
extension Section {
struct LocalizedMetadata {
let id: String
let title: String
let subtitle: String?
let description: String
/**
The text on the link to show the section page when previewing multiple sections on an overview page.
*/
let moreLinkTitle: String
/**
An optional text to display in the corner of the section thumbnail.
Can be used to show things like "new", "draft", etc.
*/
let cornerText: String?
let linkPreview: LinkPreviewMetadata?
/**
The text on the back navigation link of contained elements.
This text does not appear on the section page, but on the pages contained within the section.
*/
let backLinkText: String?
}
}
extension Section.LocalizedMetadata: Codable {
}
extension Section.LocalizedMetadata: LanguageIdentifiable {
var languageIdentifier: String {
id
}
}
extension Section.LocalizedMetadata {
static var initial: Section.LocalizedMetadata {
.init(id: "en",
title: "Section title",
subtitle: "Tag line below the title",
description: "The short text below the tagline on the section overview page",
moreLinkTitle: "More section items",
cornerText: nil,
linkPreview: .initial,
backLinkText: "Back to section")
}
}
extension Section.LocalizedMetadata: LinkPreviewMetadataProvider {
}