diff --git a/index.js b/index.js index 1c1fbdf..6422cda 100644 --- a/index.js +++ b/index.js @@ -13,7 +13,7 @@ var dataPath = path.join(__dirname, 'data') var postsPath = path.join(dataPath, 'posts') var staticPath = path.join(__dirname, 'static') -var watcher = chokidar.watch(postsPath) +var watcher = chokidar.watch(dataPath) var app = express() @@ -33,16 +33,23 @@ app.listen(PORT, () => { }) function pageUpdate() { - var postsArray = fs.readdirSync(postsPath).reverse() + var data = JSON.parse(fs.readFileSync(path.join(dataPath, 'data.json'))) + var postsArray = data.posts var html = "" for (var i = 0; i < postsArray.length; i++) { var addedHTML = "" var post = postsArray[i] - post = post.substring(post.indexOf("]") + 2, post.length - 3) + - addedHTML += `
Couldn't find this post... Maybe try clearing your cache? Violet's Limbo is currently going through alot of backend changes, so expect things to break!
") - res.send(html) - - return - } - - postName = postsDict[postName] - - var post = fs.readFileSync(path.join(postsPath, postName)).toString() - - post = mkthtml.makeHtml(post) - var html = fs.readFileSync(path.join(__dirname, 'resources/postPage.html')).toString() - - html = html.replace('{POST}', post) - html = html.replace('{POST_TITLE}', postName.substring(postName.indexOf("]") + 2, postName.length - 3)) - + html = html.replace("{POST_TITLE}", "Not found!") + html = html.replace("{POST}", "Couldn't find this post... Maybe try clearing your cache? Violet's Limbo is currently going through alot of backend changes, so expect things to break!
") res.send(html) + + return + }) \ No newline at end of file diff --git a/resources/mainPage.html b/resources/mainPage.html index 42f0e6a..8f5459a 100644 --- a/resources/mainPage.html +++ b/resources/mainPage.html @@ -10,7 +10,12 @@Violet's Limbo is just a bunch of random blogs I decided to post, because why not :>
+Currently its very early in development, and is going through a large rewrite :P
+Enjoy my bad opinions!