Allow controlling number of blog posts in Recent Blogs sidebar. (#432)

New feature. Allow controlling number of blog posts in Recent Blogs sidebar. Can have qty or ALL.
This commit is contained in:
Eric Nakagawa 2018-02-02 08:11:51 -08:00 committed by Joel Marcey
parent c99cdefd3a
commit dfb70e1829
3 changed files with 35 additions and 4 deletions

View file

@ -365,17 +365,23 @@ function generateMetadataBlog() {
filePathDateArr[2] +
'T06:00:00.000Z'
);
// allow easier sorting of blog by providing seconds since epoch
metadata.seconds = Math.round(metadata.date.getTime() / 1000);
metadatas.push(metadata);
});
const sortedMetadatas = metadatas.sort(
(a, b) => parseInt(b.seconds) - parseInt(a.seconds)
);
fs.writeFileSync(
__dirname + '/../core/MetadataBlog.js',
'/**\n' +
' * @generated\n' +
' */\n' +
'module.exports = ' +
JSON.stringify(metadatas, null, 2) +
JSON.stringify(sortedMetadatas, null, 2) +
';\n'
);
}