diff options
-rw-r--r-- | src/responders.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/responders.js b/src/responders.js index 19f8489..f85198f 100644 --- a/src/responders.js +++ b/src/responders.js @@ -14,16 +14,16 @@ const postDateFormatter = new Intl.DateTimeFormat("en-GB", { }); const getTemplate = name => - fs.readFileSync(`${__dirname}/templates/${name}.html`, "utf8"); + fs.readFileSync(`${__dirname}/templates/${name}`, "utf8"); function getTemplateIndent(re, template) { return re.exec(getTemplate(template))[1].length; } const findMain = /^(\s+)<main/m; -const baseIndentLevel = getTemplateIndent(findMain, "layout"); +const baseIndentLevel = getTemplateIndent(findMain, "layout.html"); const findPostContent = /^(\s+)<div class="e-content/m; const postIndentLevel = - baseIndentLevel + getTemplateIndent(findPostContent, "post"); + baseIndentLevel + getTemplateIndent(findPostContent, "post.html"); function indentForTemplate(text, indentLevel) { return indent(text, indentLevel).slice(indentLevel).replace(/\n+$/, ""); @@ -34,10 +34,10 @@ function templateReader(template, indentLevel) { } const templates = { - layout: templateReader("layout"), - home: templateReader("home", baseIndentLevel), - post: templateReader("post", baseIndentLevel), - list: templateReader("list", baseIndentLevel) + layout: templateReader("layout.html"), + home: templateReader("home.html", baseIndentLevel), + post: templateReader("post.html", baseIndentLevel), + list: templateReader("list.html", baseIndentLevel) }; function title(siteTitle, pageTitle) { |