Custom page link texts, optional post title

This commit is contained in:
Christoph Hagen
2025-01-07 10:34:36 +01:00
parent 1f7167b076
commit 2a50773e2f
16 changed files with 98 additions and 48 deletions

View File

@ -107,11 +107,17 @@ final class Post: Item {
tags.append(tag)
}
func localized(in language: ContentLanguage) -> LocalizedPost {
switch language {
case .english: return english
case .german: return german
}
/**
A title for the UI, not the generation.
*/
override func title(in language: ContentLanguage) -> String {
localized(in: language).title ?? id
}
func contains(_ string: String) -> Bool {
id.contains(string) ||
german.contains(string) ||
english.contains(string)
}
func isValid(id: String) -> Bool {
@ -134,3 +140,7 @@ final class Post: Item {
extension Post: DateItem {
}
extension Post: LocalizedItem {
}