From 2d8fc2cfa3e6ab9d4d199deee7e6ceadfdb72d4e Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Wed, 25 Dec 2019 06:06:41 +0000 Subject: [PATCH] Fix post template --- .../Sources/samhuri.net/Posts/PageRenderer+Posts.swift | 2 +- samhuri.net/Sources/samhuri.net/Posts/PostTemplate.swift | 4 ++-- .../Sources/samhuri.net/Posts/RecentPostsTemplate.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samhuri.net/Sources/samhuri.net/Posts/PageRenderer+Posts.swift b/samhuri.net/Sources/samhuri.net/Posts/PageRenderer+Posts.swift index 9899bbc..0107e59 100644 --- a/samhuri.net/Sources/samhuri.net/Posts/PageRenderer+Posts.swift +++ b/samhuri.net/Sources/samhuri.net/Posts/PageRenderer+Posts.swift @@ -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 { diff --git a/samhuri.net/Sources/samhuri.net/Posts/PostTemplate.swift b/samhuri.net/Sources/samhuri.net/Posts/PostTemplate.swift index f743cd6..cac06fe 100644 --- a/samhuri.net/Sources/samhuri.net/Posts/PostTemplate.swift +++ b/samhuri.net/Sources/samhuri.net/Posts/PostTemplate.swift @@ -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)), diff --git a/samhuri.net/Sources/samhuri.net/Posts/RecentPostsTemplate.swift b/samhuri.net/Sources/samhuri.net/Posts/RecentPostsTemplate.swift index 98a4945..58e791d 100644 --- a/samhuri.net/Sources/samhuri.net/Posts/RecentPostsTemplate.swift +++ b/samhuri.net/Sources/samhuri.net/Posts/RecentPostsTemplate.swift @@ -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) }) ) } }