Sort posts before reversing, filter ignored

This commit is contained in:
Jocelyn Badgley (Twipped) 2020-03-05 19:40:31 -08:00
parent e6f12453b8
commit 13c149c9e0
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ const loadPostFiles = require('./posts');
const Cache = require('./cache');
const Promise = require('bluebird');
const fs = require('fs-extra');
const { sortBy } = require('lodash');
const primeTweets = require('./page-tweets');
const pageWriter = require('./page-writer');
@ -36,9 +37,10 @@ exports.everything = function (prod = false) {
// prime tweet data for all pages
const pages = await primeTweets(PublicFiles.pages);
const posts = await primeTweets(PostFiles.pages);
const pages = await primeTweets(PublicFiles.pages.filter((p) => !p.meta.ignore));
let posts = await primeTweets(PostFiles.pages.filter((p) => !p.meta.ignore));
posts = sortBy(posts, 'date');
posts.reverse();
// compile all tasks to be completed

View File

@ -93,6 +93,7 @@ module.exports = exports = class Page extends File {
_parse (PublicFiles) {
const { titlecard, webready } = PublicFiles.for(this.dir);
this.ignore = this.meta.ignore;
this.images = webready;
this.titlecard = titlecard;
this.tweets = (this.meta.tweets || []).map(parseTweetId);