Finally sorted by date
This commit is contained in:
parent
9772637055
commit
7a2fb2a5f0
2 changed files with 14 additions and 2 deletions
13
index.js
13
index.js
|
@ -33,7 +33,18 @@ app.listen(PORT, () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
function pageUpdate() {
|
function pageUpdate() {
|
||||||
var postsArray = fs.readdirSync(postsPath)
|
var postsArray = fs.readdirSync(postsPath, function(err, files){
|
||||||
|
files = files.map(function (fileName) {
|
||||||
|
return {
|
||||||
|
name: fileName,
|
||||||
|
time: fs.statSync(dir + '/' + fileName).mtime.getTime()
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.sort(function (a, b) {
|
||||||
|
return a.time - b.time; })
|
||||||
|
.map(function (v) {
|
||||||
|
return v.name; });
|
||||||
|
})
|
||||||
var posts = {}
|
var posts = {}
|
||||||
|
|
||||||
for (let index = 0; index < postsArray.length; index++) {
|
for (let index = 0; index < postsArray.length; index++) {
|
||||||
|
|
|
@ -8,7 +8,8 @@
|
||||||
<link rel="stylesheet" href="https://violets-purgatory.dev/style.css">
|
<link rel="stylesheet" href="https://violets-purgatory.dev/style.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Welcome to Violet's Limbo!</h1>
|
<a>Home</a>
|
||||||
|
<h1>Violet's Limbo!</h1>
|
||||||
<h2>Posts:</h2>
|
<h2>Posts:</h2>
|
||||||
{POSTS}
|
{POSTS}
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue