|
|
@ -69,27 +69,25 @@ export default class Utils {
|
|
|
|
let obj = filtered[index].metadata;
|
|
|
|
let obj = filtered[index].metadata;
|
|
|
|
let month = moment(obj.created).format('MM');
|
|
|
|
let month = moment(obj.created).format('MM');
|
|
|
|
if (!_.find(sorted, { month: month })) {
|
|
|
|
if (!_.find(sorted, { month: month })) {
|
|
|
|
let sortedPages = _.filter(pages, page => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
moment(page.metadata.created).format('YYYY') === item.year &&
|
|
|
|
|
|
|
|
moment(page.metadata.created).format('MM') === month
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sorted.push({
|
|
|
|
sorted.push({
|
|
|
|
month: month,
|
|
|
|
month: month,
|
|
|
|
full_month: moment(obj.created).format('MMMM'),
|
|
|
|
full_month: moment(obj.created).format('MMMM'),
|
|
|
|
count: 1,
|
|
|
|
count: 1,
|
|
|
|
pages: sortedPages
|
|
|
|
pages: _.filter(pages, page => {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
moment(page.metadata.created).format('YYYY') === item.year &&
|
|
|
|
|
|
|
|
moment(page.metadata.created).format('MM') === month &&
|
|
|
|
|
|
|
|
page.metadata.deleted === false &&
|
|
|
|
|
|
|
|
page.metadata.layout !== 'index'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
_.find(sorted, { month: month }).count++;
|
|
|
|
_.find(sorted, { month: month }).count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
archive.push({ year: item.year, year_data: sorted });
|
|
|
|
archive.push({ year: item.year, year_data: sorted });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
render.publishArchive(archive);
|
|
|
|
render.publishArchive(archive);
|
|
|
|
//console.log('ARCHIVE', archive[0].meta[0]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|