From 8e9fb739582b5ed871522826ea145f4a9dac2777 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 8 Feb 2020 13:47:47 +0000 Subject: refactor(web/blog): Use timestamps for dates instead of strings This lets me easily create an ordered list of entries if the homepage is designed to list both blog posts and other content. --- web/blog/default.nix | 5 ++--- web/blog/fragments.nix | 8 ++++++-- web/blog/posts.nix | 10 +++++----- 3 files changed, 13 insertions(+), 10 deletions(-) (limited to 'web/blog') diff --git a/web/blog/default.nix b/web/blog/default.nix index bc7b9666f79b..1bc026bf2a8c 100644 --- a/web/blog/default.nix +++ b/web/blog/default.nix @@ -11,7 +11,7 @@ let post = struct "blog-post" { key = string; # title = string; - date = string; # *sigh* + date = int; # Path to the Markdown file containing the post content. content = path; @@ -39,8 +39,7 @@ let ${lib.concatStringsSep "\n" (map (post: "cp ${fragments.renderPost post} $out/${post.key}.html" ) posts)} - ''; # '' (this line makes nix-mode happy :/) - + ''; in import ./nginx.nix (args // { inherit posts renderedBlog; }) diff --git a/web/blog/fragments.nix b/web/blog/fragments.nix index 2c9127b7f713..4af642c01e24 100644 --- a/web/blog/fragments.nix +++ b/web/blog/fragments.nix @@ -51,9 +51,13 @@ let renderPost = post: runCommandNoCC "${post.key}.html" {} '' cat ${toFile "header.html" (header post.title)} > $out - # Write the actual post + # Write the post title & date echo '

${escape post.title}

' >> $out - echo '' >> $out + echo '' >> $out + + # Write the actual post through cheddar's about-filter mechanism cat ${post.content} | ${pkgs.tools.cheddar}/bin/cheddar --about-filter ${post.content} >> $out echo '
' >> $out diff --git a/web/blog/posts.nix b/web/blog/posts.nix index e6fb821f959f..164ffa142d5b 100644 --- a/web/blog/posts.nix +++ b/web/blog/posts.nix @@ -3,35 +3,35 @@ { key = "reversing-watchguard-vpn"; title = "Reverse-engineering WatchGuard Mobile VPN"; - date = "2017-02-11"; + date = 1486830338; content = ./posts/reversing-watchguard-vpn.md; oldKey = "1486830338"; } { key = "make-object-t-again"; title = "Make Object Again!"; - date = "2016-10-18"; + date = 1476807384; content = ./posts/make-object-t-again.md; oldKey = "1476807384"; } { key = "the-smu-problem"; title = "The SMU-problem of messaging apps"; - date = "2015-12-17"; + date = 1450354078; content =./posts/the-smu-problem.md; oldKey = "1450354078"; } { key = "sick-in-sweden"; title = "Being sick in Sweden"; - date = "2015-02-15"; + date = 1423995834; content = ./posts/sick-in-sweden.md; oldKey = "1423995834"; } { key = "nsa-zettabytes"; title = "The NSA's 5 zettabytes of data"; - date = "2013-07-31"; + date = 1375310627; content = ./posts/nsa-zettabytes.md; oldKey = "1375310627"; } -- cgit 1.4.1