make sure date later than now will now be publish

This commit is contained in:
polv committed 2020-12-18 16:32:43 +07:00
1 parent 9ea60c68c7
commit d8161be401
47 files changed
+25 -11589

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
paths: Array(
Math.ceil(
dbPost.find({
date: { $exists: true } as any
date: { $lt: new Date().getTime() }
}).length / 5
) - 1
)
+3 -1
View File
@@ -35,7 +35,9 @@ export const getStaticPaths: GetStaticPaths = async () => {
await initDatabase()
const tMap = new Map<string, number>()
dbPost.find().map(({ tag = [] }) => {
dbPost.find({
date: { $lt: new Date().getTime() }
}).map(({ tag = [] }) => {
return tag.map((t) => {
return tMap.set(t, (tMap.get(t) || 0) + 1)
})