All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 2m50s
37 lines
653 B
Swift
37 lines
653 B
Swift
import HTML
|
|
import Saga
|
|
|
|
func renderPage(context: ItemRenderingContext<PageMetadata>) -> Node {
|
|
let section = Section(rawValue: context.item.metadata.section ?? "")
|
|
assert(section != nil)
|
|
|
|
return baseLayout(
|
|
canocicalURL: context.item.url,
|
|
section: section!,
|
|
title: context.item.title
|
|
) {
|
|
switch section {
|
|
case .home:
|
|
renderHome(body: context.item.body)
|
|
default:
|
|
renderNonHome(body: context.item.body)
|
|
}
|
|
}
|
|
}
|
|
|
|
func renderHome(body: String) -> Node {
|
|
div {
|
|
Node.raw(body)
|
|
}
|
|
}
|
|
|
|
func renderNonHome(body: String) -> Node {
|
|
div {
|
|
article {
|
|
div {
|
|
Node.raw(body)
|
|
}
|
|
}
|
|
}
|
|
}
|