Fix id of Items, saving

This commit is contained in:
Christoph Hagen
2025-06-11 08:19:44 +02:00
parent 5970ce2e9f
commit 1d0eba9d78
64 changed files with 233 additions and 217 deletions

View File

@@ -69,7 +69,7 @@ extension Content {
continue
}
let path = file.absoluteUrl
if !storage.copy(file: file.id, to: path) {
if !storage.copy(file: file.identifier, to: path) {
results.general.unsavedOutput(path, source: .general)
}
}
@@ -147,23 +147,23 @@ extension Content {
// MARK: Find items by id
func page(_ pageId: String) -> Page? {
pages.first { $0.id == pageId }
pages.first { $0.identifier == pageId }
}
func image(_ imageId: String) -> FileResource? {
files.first { $0.id == imageId && $0.type.isImage }
files.first { $0.identifier == imageId && $0.type.isImage }
}
func video(_ videoId: String) -> FileResource? {
files.first { $0.id == videoId && $0.type.isVideo }
files.first { $0.identifier == videoId && $0.type.isVideo }
}
func file(_ fileId: String) -> FileResource? {
files.first { $0.id == fileId }
files.first { $0.identifier == fileId }
}
func tag(_ tagId: String) -> Tag? {
tags.first { $0.id == tagId }
tags.first { $0.identifier == tagId }
}
// MARK: Generation input
@@ -322,12 +322,12 @@ extension Content {
let pageUrl = settings.general.url + relativePageUrl
guard let content = pageGenerator.generate(page: page, language: language, results: results, pageUrl: pageUrl) else {
print("Failed to generate page \(page.id) in language \(language)")
print("Failed to generate page \(page.identifier) in language \(language)")
return
}
guard storage.write(content, to: filePath) else {
print("Failed to save page \(page.id)")
print("Failed to save page \(page.identifier)")
return
}