Article rendering tests
This commit is contained in:
+3
-3
@@ -75,7 +75,7 @@ module.exports = (config) => {
|
||||
.map((path) => path.match(/^\/(\d{4})\/(\d{2})\/(\d{2})\/$/))
|
||||
.filter((matches) => matches && matches.length > 1);
|
||||
if (paths.length === 0)
|
||||
cb(null, []);
|
||||
cb(null, {});
|
||||
const articles = {};
|
||||
let remaining = 0;
|
||||
paths.forEach((matches) => {
|
||||
@@ -94,8 +94,8 @@ module.exports = (config) => {
|
||||
article.title = info.title || config['article']['default_title'];
|
||||
article.thumbnail = info.thumbnail ? path.join(article.path, info.thumbnail) : config['article']['default_thumbnail'];
|
||||
article.escapedTitle = article.title.toLowerCase().replace(/[^\w]/gm, ' ').trim().replace(/ /gm, '_');
|
||||
article.url = path.join(article.path, article.escapedTitle)+'/';
|
||||
articles[article.path]=article;
|
||||
article.url = '/' + path.join(article.path, article.escapedTitle) + '/';
|
||||
articles[article.path] = article;
|
||||
remaining--;
|
||||
if (remaining === 0)
|
||||
cb(null, articles);
|
||||
|
||||
Reference in New Issue
Block a user