refact: extract layout page logic

This commit is contained in:
Jean-Philippe Sirois
2020-01-25 14:04:38 -05:00
parent d62fe36475
commit 8722d15be5
8 changed files with 88 additions and 63 deletions
+5
View File
@@ -9,8 +9,13 @@ const requiredArticleFrontmatter = ["authors", "date"]
const LAYOUT_RESOURCES = "resources"
const LAYOUT_ARCHIVES = "archives"
const LAYOUT_REGULAR = "regular"
const LAYOUT_HOME = "home"
function resolveLayout(path) {
if (path === "/") {
return LAYOUT_HOME
}
if (path.match(/resources/)) {
return LAYOUT_RESOURCES
}