diff --git a/blog/posts.json b/blog/posts.json index 0c72f0f..f0baf57 100644 --- a/blog/posts.json +++ b/blog/posts.json @@ -3,7 +3,8 @@ "summary": "The first post and how I created it", "id": "blogs_are_cool", "date": "2/17/2019", - "discuss": "https://twitter.com/Ellpeck/status/1096937184601538566" + "discuss": "https://twitter.com/Ellpeck/status/1096937184601538566", + "archived": true }, { "name": "Why You Should Mod Minecraft", @@ -31,7 +32,8 @@ "summary": "How moving from Java to C# taught me how horrible it is to create a cross-platform application with little to no knowledge or documentation", "id": "cross_platform_trainwreck", "date": "7/6/2019", - "discuss": "https://twitter.com/Ellpeck/status/1147502654236573697" + "discuss": "https://twitter.com/Ellpeck/status/1147502654236573697", + "archived": true }, { "name": "Big Projects", @@ -87,7 +89,8 @@ "summary": "About depression and what it feels like when I don't know what to do with myself", "id": "lows", "date": "10/20/2019", - "discuss": "https://twitter.com/Ellpeck/status/1186028260838334471" + "discuss": "https://twitter.com/Ellpeck/status/1186028260838334471", + "archived": true }, { "name": "Java Tutorial, Part 6: Inheritance", diff --git a/node/blog.js b/node/blog.js index 817003e..ab3c2a8 100644 --- a/node/blog.js +++ b/node/blog.js @@ -25,10 +25,12 @@ fs.readFile(folder + "index.html", function (_, data) { var nav = ""; nav += 'Back to Main Page'; - if (i > 0) - nav += 'Previous Post'; - if (i < json.length - 1) - nav += 'Next Post'; + let last = getAdjacentPost(json, i, -1); + if (last) + nav += 'Previous Post'; + let next = getAdjacentPost(json, i, 1); + if (next) + nav += 'Next Post'; document.getElementById("nav-items").innerHTML = nav; var c = ""; @@ -36,12 +38,13 @@ fs.readFile(folder + "index.html", function (_, data) { c += '
This post has been archived.
" c += converter.makeHtml(content.toString()); c += '