diff options
Diffstat (limited to 'modules/blog/template.js')
-rw-r--r-- | modules/blog/template.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/blog/template.js b/modules/blog/template.js index 38ce72e..32d7bb3 100644 --- a/modules/blog/template.js +++ b/modules/blog/template.js @@ -19,6 +19,7 @@ async function recursiveTree(dir) { return res; } +// path: url prefix function generateTree(tree, path) { let out = ""; @@ -45,11 +46,10 @@ async function template(repodir, contentPath) { let html = await fs.readFile(repodir + "/$template.html", { encoding: "utf-8" }); + const content = await fs.readFile(repodir + "/" + contentPath, { encoding: "utf-8" }); + html = html.replace("<!-- REPLACE TREE -->", generateTree(tree, pathRoot)); - if (contentPath) { - const content = await fs.readFile(repodir + "/" + contentPath, { encoding: "utf-8" }); - html = html.replace("<!-- REPLACE CONTENT -->", content); - } + html = html.replace("<!-- REPLACE CONTENT -->", content); return html; } |