|
|
|
@ -24,7 +24,7 @@ export default class Render {
|
|
|
|
|
* @parameter pages: payload for site pages
|
|
|
|
|
* @parameter theme: current theme being used as defined in settings
|
|
|
|
|
*/
|
|
|
|
|
publishAll(pages, theme) {
|
|
|
|
|
publishAll(pages, theme, author) {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
settings
|
|
|
|
|
.load(SETTINGS_FILE)
|
|
|
|
@ -68,15 +68,28 @@ export default class Render {
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let bag = page.metadata.tags.split(',');
|
|
|
|
|
let tags = [];
|
|
|
|
|
for (let index = 0; index < bag.length; index++) {
|
|
|
|
|
let tag = bag[index].trim();
|
|
|
|
|
tags.push({
|
|
|
|
|
label: bag[index],
|
|
|
|
|
slug: new StringUtils().cleanString(tag)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
buffed = new StringUtils().decodeHTML(buffed);
|
|
|
|
|
let html = md.render(buffed, { html: true, xhtmlOut: true });
|
|
|
|
|
let file = pug.renderFile(template, {
|
|
|
|
|
title: page.metadata.title,
|
|
|
|
|
default_bg: page.metadata.feature,
|
|
|
|
|
content: html,
|
|
|
|
|
tags: page.metadata.tags,
|
|
|
|
|
tags: tags,
|
|
|
|
|
menu: config.menu,
|
|
|
|
|
meta: {
|
|
|
|
|
who: author,
|
|
|
|
|
when: moment(page.metadata.created).fromNow(),
|
|
|
|
|
tags: tags
|
|
|
|
|
},
|
|
|
|
|
welcome_message: page.metadata.title
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -119,7 +132,11 @@ export default class Render {
|
|
|
|
|
'/' +
|
|
|
|
|
page.metadata.slug +
|
|
|
|
|
'.html'
|
|
|
|
|
);
|
|
|
|
|
)
|
|
|
|
|
.then()
|
|
|
|
|
.catch(err => {
|
|
|
|
|
console.log('ERROR', err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|