1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 18:32:50 +00:00

too many changes - load posts now

This commit is contained in:
2016-08-24 00:29:00 -05:00
parent 24ef17ac5b
commit 7b48c79180
26 changed files with 354 additions and 272 deletions

View File

@@ -36,13 +36,12 @@ function parse_dir(dir, folder_name){
} else {
const file = fs.readFileSync(dir+post, 'utf8');
const tokens = marked.lexer(file, null);
const path = dir + post;
const temp = {
path: path.slice(1, path.length),
filename: post.slice(0, post.length - 3),
category: folder_name,
date: post.slice(0, 10),
title: marked('<h2>' + tokens[0].text + '</h2>'),
intro: marked(tokens[1].text)
title: tokens[0].text,
intro: tokens[1].text
}
json.posts.push(temp);
}