diff --git a/WebsiteGenerator/Content/Element.swift b/WebsiteGenerator/Content/Element.swift index fb766bb..0710b65 100644 --- a/WebsiteGenerator/Content/Element.swift +++ b/WebsiteGenerator/Content/Element.swift @@ -258,7 +258,7 @@ extension Element { } } - private var sortedItems: [Element] { + var sortedItems: [Element] { if useManualSorting { return shownItems.sorted { $0.sortIndex! < $1.sortIndex! } } @@ -308,7 +308,8 @@ extension Element { */ func thumbnailFilePath(for language: String) -> String { guard let thumbnailFile = Element.findThumbnail(for: language, in: inputFolder) else { - fatalError() + log.add(error: "Missing thumbnail", source: path) + return Element.defaultThumbnailName } return pathRelativeToRootForContainedInputFile(thumbnailFile) } diff --git a/WebsiteGenerator/Generators/IndexPageGenerator.swift b/WebsiteGenerator/Generators/IndexPageGenerator.swift index d3bb458..662b311 100644 --- a/WebsiteGenerator/Generators/IndexPageGenerator.swift +++ b/WebsiteGenerator/Generators/IndexPageGenerator.swift @@ -22,7 +22,7 @@ struct IndexPageGenerator { content[.contentClass] = "overview" content[.header] = makeHeader(page: site, metadata: localized, language: language) content[.content] = factory.overviewSection.generate( - sections: site.elements, + sections: site.sortedItems, in: site, language: language, sectionItemCount: sectionItemCount) diff --git a/WebsiteGenerator/Generators/OverviewPageGenerator.swift b/WebsiteGenerator/Generators/OverviewPageGenerator.swift index 7326d87..48742ff 100644 --- a/WebsiteGenerator/Generators/OverviewPageGenerator.swift +++ b/WebsiteGenerator/Generators/OverviewPageGenerator.swift @@ -15,7 +15,6 @@ struct OverviewPageGenerator { let url = files.urlInOutputFolder(path) let metadata = section.localized(for: language) - let backLinkText = section.backLinkText(for: language) var content = [PageTemplate.Key : String]() content[.head] = factory.pageHead.generate(page: section, language: language) @@ -36,7 +35,7 @@ struct OverviewPageGenerator { private func makeContent(section: Element, language: String) -> String { if section.hasNestingElements { return factory.overviewSection.generate( - sections: section.elements, + sections: section.sortedItems, in: section, language: language, sectionItemCount: section.overviewItemCount)