diff --git a/DESI.md b/DESI.md index 8e8f0af..430ff7f 100644 --- a/DESI.md +++ b/DESI.md @@ -5,6 +5,13 @@ Every template gets an object with the exact same structure - whether it's a tem Here we only document Desirae's default behavior, but there are many objects added for compatibility with Ruhoh that are not documented. +config.yml vs site.yml +------ + +site.yml is for anything that changes the content of the site (navigation, title, analytic and ad ids, default author, etc) + +config.yml is for anything that doesn't change the site (from where to read directories, which order to load plugins) + ``` desi = {} ``` diff --git a/desirae.js b/desirae.js index 9c26b4e..8d10bd7 100644 --- a/desirae.js +++ b/desirae.js @@ -252,7 +252,17 @@ desi[key] = clone(arr[key]); }); + // TODO just walk all of ./*.yml authors, posts, themes, _root from the get-go desi.config.rootdir = desi.config.rootdir || '_root'; + if ('object' !== typeof desi.config.collections || !Object.keys(desi.config.collections).length) { + desi.config.collections = { 'posts': {} }; + } + if ('object' !== typeof desi.config.themes || !Object.keys(desi.config.themes).length) { + desi.config.themes = { 'default': 'twitter', 'twitter': {} }; + } + if ('object' !== typeof desi.config.assets || !Object.keys(desi.config.assets).length) { + desi.config.assets = { 'media': {} }; + } var collectionnames = Object.keys(desi.config.collections) , themenames = Object.keys(desi.config.themes) @@ -302,17 +312,19 @@ function noErrors(map) { Object.keys(map).forEach(function (path) { map[path] = map[path].filter(function (m) { - if (!m.error && m.size) { - return true; - } - - if (!m.size) { - console.warn("Ignoring 0 byte file " + (m.path || m.name)); + if (m.error) { + console.warn("Couldn't read '" + (m.path || m.name) + "'"); + console.warn(m.error); return false; } - console.warn("Couldn't get stats for " + (m.path || m.name)); - console.warn(m.error); + if (!m.size) { + console.warn("Ignoring 0 byte file '" + (m.path || m.name) + "'"); + console.warn(m.error); + return false; + } + + return true; }); }); diff --git a/lib/deardesi-browser.js b/lib/deardesi-browser.js index 824171d..e44556f 100644 --- a/lib/deardesi-browser.js +++ b/lib/deardesi-browser.js @@ -312,8 +312,6 @@ }); }); - console.info('getAllPartialts', results); - console.info(partials); return partials; }); };