mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-27 14:57:40 +00:00
Fix rendering posts by month
This commit is contained in:
parent
38918fe5f9
commit
666b926d53
1 changed files with 1 additions and 1 deletions
|
|
@ -94,7 +94,7 @@ final class PostsPlugin: Plugin {
|
||||||
|
|
||||||
let monthDir = yearDir.appendingPathComponent(month.padded)
|
let monthDir = yearDir.appendingPathComponent(month.padded)
|
||||||
try fileManager.createDirectory(at: monthDir, withIntermediateDirectories: true, attributes: nil)
|
try fileManager.createDirectory(at: monthDir, withIntermediateDirectories: true, attributes: nil)
|
||||||
let context: [String: Any] = ["path": postsPath, "month": month, "posts": renderedPosts]
|
let context: [String: Any] = ["posts": renderedPosts.map { $0.dictionary }]
|
||||||
let monthHTML = try templateRenderer.renderTemplate(name: "posts-month", context: context)
|
let monthHTML = try templateRenderer.renderTemplate(name: "posts-month", context: context)
|
||||||
let monthURL = monthDir.appendingPathComponent("index.html")
|
let monthURL = monthDir.appendingPathComponent("index.html")
|
||||||
try monthHTML.write(to: monthURL, atomically: true, encoding: .utf8)
|
try monthHTML.write(to: monthURL, atomically: true, encoding: .utf8)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue