summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2017-07-08 22:04:03 +0200
committerAlan Pearce2017-07-08 22:04:03 +0200
commitf1dabb589af4cfaf15d04ff7c399f8a9a2d5223a (patch)
treea99f713fbe3031f18fe2495ee7bf59326e7ccb83
parent3d70c97f2b6dc79244f067ca95535ac8c4f0f63b (diff)
downloadhomestead-f1dabb589af4cfaf15d04ff7c399f8a9a2d5223a.tar.lz
homestead-f1dabb589af4cfaf15d04ff7c399f8a9a2d5223a.tar.zst
homestead-f1dabb589af4cfaf15d04ff7c399f8a9a2d5223a.zip
fix(Responders): Don't assume templates are HTML
XML feeds will be necessary for Atom or RSS feeds
-rw-r--r--src/responders.js14
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) {