consolidate tags, hide date
This commit is contained in:
@@ -17,6 +17,9 @@ final class Page: Item {
|
||||
@Published
|
||||
var createdDate: Date
|
||||
|
||||
@Published
|
||||
var hideDate: Bool
|
||||
|
||||
@Published
|
||||
var startDate: Date
|
||||
|
||||
@@ -46,6 +49,7 @@ final class Page: Item {
|
||||
externalLink: String?,
|
||||
isDraft: Bool,
|
||||
createdDate: Date,
|
||||
hideDate: Bool,
|
||||
startDate: Date,
|
||||
endDate: Date?,
|
||||
german: LocalizedPage,
|
||||
@@ -55,6 +59,7 @@ final class Page: Item {
|
||||
self.externalLink = externalLink
|
||||
self.isDraft = isDraft
|
||||
self.createdDate = createdDate
|
||||
self.hideDate = hideDate
|
||||
self.startDate = startDate
|
||||
self.hasEndDate = endDate != nil
|
||||
self.endDate = endDate ?? startDate
|
||||
@@ -86,6 +91,34 @@ final class Page: Item {
|
||||
externalLink != nil
|
||||
}
|
||||
|
||||
// MARK: Tags
|
||||
|
||||
/**
|
||||
Check if a tag is associated with this page
|
||||
*/
|
||||
func contains(_ tag: Tag) -> Bool {
|
||||
tags.contains(tag)
|
||||
}
|
||||
|
||||
func toggle(_ tag: Tag) {
|
||||
guard let index = tags.firstIndex(of: tag) else {
|
||||
tags.append(tag)
|
||||
return
|
||||
}
|
||||
tags.remove(at: index)
|
||||
}
|
||||
|
||||
func remove(_ tag: Tag) {
|
||||
tags.remove(tag)
|
||||
}
|
||||
|
||||
func associate(_ tag: Tag) {
|
||||
guard !tags.contains(tag) else {
|
||||
return
|
||||
}
|
||||
tags.append(tag)
|
||||
}
|
||||
|
||||
// MARK: Paths
|
||||
|
||||
override func absoluteUrl(in language: ContentLanguage) -> String {
|
||||
|
Reference in New Issue
Block a user