mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-24 14:27:41 +00:00
Fix post template
This commit is contained in:
parent
1e8330dda4
commit
2d8fc2cfa3
3 changed files with 4 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ extension PageRenderer: PostsTemplateRenderer {
|
||||||
|
|
||||||
func renderPost(_ post: Post, site: Site, assets: TemplateAssets) throws -> String {
|
func renderPost(_ post: Post, site: Site, assets: TemplateAssets) throws -> String {
|
||||||
let context = SiteContext(site: site, subtitle: post.title, templateAssets: assets)
|
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 {
|
func renderRecentPosts(_ posts: [Post], site: Site, assets: TemplateAssets) throws -> String {
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,9 @@ import Foundation
|
||||||
import Plot
|
import Plot
|
||||||
|
|
||||||
extension Node where Context == HTML.BodyContext {
|
extension Node where Context == HTML.BodyContext {
|
||||||
static func post(_ post: Post) -> Self {
|
static func post(_ post: Post, articleClass: String = "") -> Self {
|
||||||
.group([
|
.group([
|
||||||
.article(
|
.article(.class(articleClass),
|
||||||
.header(
|
.header(
|
||||||
.h2(postTitleLink(post)),
|
.h2(postTitleLink(post)),
|
||||||
.time(.text(post.formattedDate)),
|
.time(.text(post.formattedDate)),
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import Plot
|
||||||
extension Node where Context == HTML.BodyContext {
|
extension Node where Context == HTML.BodyContext {
|
||||||
static func recentPosts(_ posts: [Post]) -> Self {
|
static func recentPosts(_ posts: [Post]) -> Self {
|
||||||
.div(.class("container"),
|
.div(.class("container"),
|
||||||
.group(posts.map(post))
|
.group(posts.map { self.post($0) })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue