Generate tag overview, add file action

This commit is contained in:
Christoph Hagen
2025-01-05 09:21:21 +01:00
parent 0dca633805
commit 01baf560ee
27 changed files with 501 additions and 137 deletions

View File

@ -26,12 +26,19 @@ final class Tag: Item {
super.init(content: content, id: id)
}
var linkName: String {
id.lowercased().replacingOccurrences(of: " ", with: "-")
func isValid(id: String) -> Bool {
content.isValidIdForTagOrPageOrPost(id) &&
content.isNewIdForTag(id)
}
var url: String {
"/tags/\(linkName).html"
@discardableResult
func update(id newId: String) -> Bool {
guard content.storage.move(tag: id, to: newId) else {
print("Failed to move files of tag \(id)")
return false
}
id = newId
return true
}
// MARK: Paths