Generate list of redirects
This commit is contained in:
@ -77,6 +77,8 @@ final class PageGenerationResults: ObservableObject {
|
||||
|
||||
private(set) var pageIsEmpty: Bool
|
||||
|
||||
private(set) var redirect: (originalUrl: String, newUrl: String)?
|
||||
|
||||
init(itemId: ItemId, delegate: GenerationResults) {
|
||||
self.itemId = itemId
|
||||
self.delegate = delegate
|
||||
@ -100,6 +102,7 @@ final class PageGenerationResults: ObservableObject {
|
||||
warnings = []
|
||||
unsavedOutputFiles = [:]
|
||||
pageIsEmpty = false
|
||||
redirect = nil
|
||||
}
|
||||
|
||||
func reset() {
|
||||
@ -123,6 +126,7 @@ final class PageGenerationResults: ObservableObject {
|
||||
warnings = []
|
||||
unsavedOutputFiles = [:]
|
||||
pageIsEmpty = false
|
||||
redirect = nil
|
||||
}
|
||||
|
||||
// MARK: Adding entries
|
||||
@ -251,5 +255,10 @@ final class PageGenerationResults: ObservableObject {
|
||||
pageIsEmpty = true
|
||||
delegate.empty(.init(language: itemId.language, pageId: page.id))
|
||||
}
|
||||
|
||||
func redirect(from originalUrl: String, to newUrl: String) {
|
||||
redirect = (originalUrl, newUrl)
|
||||
delegate.redirect(from: originalUrl, to: newUrl)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user