Correctly sort elements
This commit is contained in:
parent
4036452d2c
commit
666074a65b
@ -258,7 +258,7 @@ extension Element {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var sortedItems: [Element] {
|
var sortedItems: [Element] {
|
||||||
if useManualSorting {
|
if useManualSorting {
|
||||||
return shownItems.sorted { $0.sortIndex! < $1.sortIndex! }
|
return shownItems.sorted { $0.sortIndex! < $1.sortIndex! }
|
||||||
}
|
}
|
||||||
@ -308,7 +308,8 @@ extension Element {
|
|||||||
*/
|
*/
|
||||||
func thumbnailFilePath(for language: String) -> String {
|
func thumbnailFilePath(for language: String) -> String {
|
||||||
guard let thumbnailFile = Element.findThumbnail(for: language, in: inputFolder) else {
|
guard let thumbnailFile = Element.findThumbnail(for: language, in: inputFolder) else {
|
||||||
fatalError()
|
log.add(error: "Missing thumbnail", source: path)
|
||||||
|
return Element.defaultThumbnailName
|
||||||
}
|
}
|
||||||
return pathRelativeToRootForContainedInputFile(thumbnailFile)
|
return pathRelativeToRootForContainedInputFile(thumbnailFile)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ struct IndexPageGenerator {
|
|||||||
content[.contentClass] = "overview"
|
content[.contentClass] = "overview"
|
||||||
content[.header] = makeHeader(page: site, metadata: localized, language: language)
|
content[.header] = makeHeader(page: site, metadata: localized, language: language)
|
||||||
content[.content] = factory.overviewSection.generate(
|
content[.content] = factory.overviewSection.generate(
|
||||||
sections: site.elements,
|
sections: site.sortedItems,
|
||||||
in: site,
|
in: site,
|
||||||
language: language,
|
language: language,
|
||||||
sectionItemCount: sectionItemCount)
|
sectionItemCount: sectionItemCount)
|
||||||
|
@ -15,7 +15,6 @@ struct OverviewPageGenerator {
|
|||||||
let url = files.urlInOutputFolder(path)
|
let url = files.urlInOutputFolder(path)
|
||||||
|
|
||||||
let metadata = section.localized(for: language)
|
let metadata = section.localized(for: language)
|
||||||
let backLinkText = section.backLinkText(for: language)
|
|
||||||
|
|
||||||
var content = [PageTemplate.Key : String]()
|
var content = [PageTemplate.Key : String]()
|
||||||
content[.head] = factory.pageHead.generate(page: section, language: language)
|
content[.head] = factory.pageHead.generate(page: section, language: language)
|
||||||
@ -36,7 +35,7 @@ struct OverviewPageGenerator {
|
|||||||
private func makeContent(section: Element, language: String) -> String {
|
private func makeContent(section: Element, language: String) -> String {
|
||||||
if section.hasNestingElements {
|
if section.hasNestingElements {
|
||||||
return factory.overviewSection.generate(
|
return factory.overviewSection.generate(
|
||||||
sections: section.elements,
|
sections: section.sortedItems,
|
||||||
in: section,
|
in: section,
|
||||||
language: language,
|
language: language,
|
||||||
sectionItemCount: section.overviewItemCount)
|
sectionItemCount: section.overviewItemCount)
|
||||||
|
Loading…
Reference in New Issue
Block a user