Files
saga-table-test/Sources/Site/templates/RenderPage.swift
Michael Housh 0c6b84a872
All checks were successful
Create and publish a Docker image / build-and-push-image (push) Successful in 2m50s
feat: Initial commit.
2025-12-12 13:13:14 -05:00

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)
}
}
}
}