Fix post template

This commit is contained in:
Sami Samhuri 2019-12-25 06:06:41 +00:00
parent 1e8330dda4
commit 2d8fc2cfa3
3 changed files with 4 additions and 4 deletions

View file

@ -26,7 +26,7 @@ extension PageRenderer: PostsTemplateRenderer {
func renderPost(_ post: Post, site: Site, assets: TemplateAssets) throws -> String {
let context = SiteContext(site: site, subtitle: post.title, templateAssets: assets)
return render(.post(post), context: context)
return render(.post(post, articleClass: "container"), context: context)
}
func renderRecentPosts(_ posts: [Post], site: Site, assets: TemplateAssets) throws -> String {

View file

@ -9,9 +9,9 @@ import Foundation
import Plot
extension Node where Context == HTML.BodyContext {
static func post(_ post: Post) -> Self {
static func post(_ post: Post, articleClass: String = "") -> Self {
.group([
.article(
.article(.class(articleClass),
.header(
.h2(postTitleLink(post)),
.time(.text(post.formattedDate)),

View file

@ -11,7 +11,7 @@ import Plot
extension Node where Context == HTML.BodyContext {
static func recentPosts(_ posts: [Post]) -> Self {
.div(.class("container"),
.group(posts.map(post))
.group(posts.map { self.post($0) })
)
}
}