diff --git a/Readme.md b/Readme.md index 64f3e5d..b64e923 100644 --- a/Readme.md +++ b/Readme.md @@ -23,18 +23,32 @@ Execution, trying TDD for the first time: - [x] Add support for site styles - - [ ] Add support for page styles + - [x] Add support for page styles - [x] Add support for site scripts - - [ ] Add support for page scripts + - [x] Add support for page scripts - [x] Add support for CSS files - [x] Transform LESS into CSS + - [ ] Migrate static pages to the new site generator + + - [ ] About + + - [ ] 404 / missing + + - [ ] cv + + - [ ] check and delete _data.json + - [ ] Migrate projects to the new site generator + - [ ] Migrate projects page + + - [ ] Migrate project page + - [ ] Migrate posts to markdown with headers somehow - [ ] Define the new format, probably with a folder for each year of posts since I don't write very much @@ -43,6 +57,14 @@ Execution, trying TDD for the first time: - [ ] Migrate posts + - [ ] Migrate year indexes + + - [ ] Migrate month indexes + + - [ ] Migrate index / recent posts + + - [ ] Migrate archive + - [ ] Add a link to the code for samhuri.net somewhere ... so meta (about page?) - [ ] Generate RSS feed (ditch mustache templates) diff --git a/SiteGenerator/Sources/SiteGenerator/Model/Post.swift b/SiteGenerator/Sources/SiteGenerator/Model/Post.swift new file mode 100644 index 0000000..afef3f0 --- /dev/null +++ b/SiteGenerator/Sources/SiteGenerator/Model/Post.swift @@ -0,0 +1,30 @@ +// +// Post.swift +// SiteGenerator +// +// Created by Sami Samhuri on 2019-12-01. +// + +import Foundation + +struct Post { + let date: Date + let formattedDate: String + let title: String + let slug: String + let author: String + let tags: [String] + let body: String + + var path: String { + let dateComponents = Calendar.current.dateComponents([.year], from: date) + let year = dateComponents.year! + let month = dateComponents.month! + return "/" + [ + "posts", + "\(year)", + "\(month)", + "\(slug)", + ].joined(separator: "/") + } +} diff --git a/Tests/test-styles/in/templates/site.html b/Tests/test-styles/in/templates/site.html index 8e140a6..1cac9e4 100644 --- a/Tests/test-styles/in/templates/site.html +++ b/Tests/test-styles/in/templates/site.html @@ -2,7 +2,7 @@