Colors, pages, post links
This commit is contained in:
@ -122,6 +122,20 @@ final class Storage {
|
||||
try loadAll(in: pagesFolder)
|
||||
}
|
||||
|
||||
func pageContent(for pageId: String, language: ContentLanguage) -> String {
|
||||
let contentUrl = pageContentUrl(pageId: pageId, language: language)
|
||||
guard fm.fileExists(atPath: contentUrl.path()) else {
|
||||
print("No file at \(contentUrl.path())")
|
||||
return "New file"
|
||||
}
|
||||
do {
|
||||
return try String(contentsOf: contentUrl, encoding: .utf8)
|
||||
} catch {
|
||||
print("Failed to load page content for \(pageId) (\(language)): \(error)")
|
||||
return error.localizedDescription
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Posts
|
||||
|
||||
/// The folder path where the markdown files of the posts are stored (by their unique id/url component)
|
||||
|
Reference in New Issue
Block a user