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