all repos — archive/homestead @ f1dabb589af4cfaf15d04ff7c399f8a9a2d5223a

My future indieweb platform

fix(Responders): Don't assume templates are HTML XML feeds will be necessary for Atom or RSS feeds

Alan Pearce
commit

f1dabb589af4cfaf15d04ff7c399f8a9a2d5223a

parent

3d70c97f2b6dc79244f067ca95535ac8c4f0f63b

1 file changed, 7 insertions(+), 7 deletions(-)

changed files
M src/responders.jssrc/responders.js
@@ -14,16 +14,16 @@ day: "numeric"
}); 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 @@ return indentForTemplate(getTemplate(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) {