var is literally the devil
This commit is contained in:
parent
e5e2c126e2
commit
9ae98b09b3
3 changed files with 8 additions and 8 deletions
10
node/rss.js
10
node/rss.js
|
@ -48,14 +48,14 @@ function createFeed(callback) {
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.readFile(__dirname + "/../blog/posts.json", function (_, data) {
|
fs.readFile(__dirname + "/../blog/posts.json", function (_, data) {
|
||||||
var json = JSON.parse(data);
|
let json = JSON.parse(data);
|
||||||
for (let i = json.length - 1; i >= 0; i--) {
|
for (let i = json.length - 1; i >= 0; i--) {
|
||||||
var post = json[i];
|
let post = json[i];
|
||||||
var id = post["id"];
|
let id = post["id"];
|
||||||
var date = new Date(post["date"]);
|
let date = new Date(post["date"]);
|
||||||
|
|
||||||
fs.readFile(__dirname + "/../blog/" + id + ".md", function (_, content) {
|
fs.readFile(__dirname + "/../blog/" + id + ".md", function (_, content) {
|
||||||
var html = converter.makeHtml(content.toString());
|
let html = converter.makeHtml(content.toString());
|
||||||
feed.addItem({
|
feed.addItem({
|
||||||
title: post["name"],
|
title: post["name"],
|
||||||
id: id,
|
id: id,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
|
|
||||||
var app = express();
|
let app = express();
|
||||||
require("./rss")(app);
|
require("./rss")(app);
|
||||||
require("./sitemap")(app);
|
require("./sitemap")(app);
|
||||||
app.listen(3000);
|
app.listen(3000);
|
|
@ -32,9 +32,9 @@ module.exports = function (app) {
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.readFile(__dirname + "/../blog/posts.json", function (_, data) {
|
fs.readFile(__dirname + "/../blog/posts.json", function (_, data) {
|
||||||
var json = JSON.parse(data);
|
let json = JSON.parse(data);
|
||||||
|
|
||||||
for (var post of json) {
|
for (let post of json) {
|
||||||
sitemap.add({
|
sitemap.add({
|
||||||
url: "/#blog-" + post["id"],
|
url: "/#blog-" + post["id"],
|
||||||
priority: 0.4
|
priority: 0.4
|
||||||
|
|
Loading…
Reference in a new issue