Add post about PVGttM
Add support for `status` prop on posts (draft or hidden) Fix fonts
This commit is contained in:
14
lib/build.js
14
lib/build.js
@@ -1,7 +1,8 @@
|
||||
const { exists } = require("fs-extra/lib/fs");
|
||||
|
||||
module.exports = async (config) => {
|
||||
const { promises: fs } = require("fs"),
|
||||
const
|
||||
{ promises: fs } = require("fs"),
|
||||
fse = require("fs-extra"),
|
||||
path = require("path"),
|
||||
ejs = require("ejs"),
|
||||
@@ -22,8 +23,9 @@ module.exports = async (config) => {
|
||||
linkify: true,
|
||||
typographer: true,
|
||||
xhtmlOut: true,
|
||||
}),
|
||||
emoji = require("markdown-it-emoji"),
|
||||
})
|
||||
.use(require("markdown-it-footnote"))
|
||||
.use(require("markdown-it-emoji")),
|
||||
// { readJsonIfExists } = require("./utils"),
|
||||
{ build, isRebuild, logFunction: log = () => {} } = config || {},
|
||||
{ outputPath, journalsPerPage = 5, srcPath } = build,
|
||||
@@ -59,6 +61,7 @@ module.exports = async (config) => {
|
||||
filePath = path.join(pagePath, file),
|
||||
// read page file
|
||||
data = fse.readFileSync(filePath, "utf-8"),
|
||||
info = fse.statSync(filePath, "utf-8"),
|
||||
// render page
|
||||
{ attributes, body } = frontMatter(data),
|
||||
{ content_type: contentType, tags: originalTags = [] } =
|
||||
@@ -94,6 +97,7 @@ module.exports = async (config) => {
|
||||
page: {
|
||||
name,
|
||||
...attributes,
|
||||
date_upd: attributes?.date_pub !== info.mtime ? info.mtime : (attributes.date_upd ?? ''),
|
||||
body: updatedBody,
|
||||
destPath,
|
||||
filePath,
|
||||
@@ -187,8 +191,6 @@ module.exports = async (config) => {
|
||||
}
|
||||
};
|
||||
|
||||
md.use(emoji);
|
||||
|
||||
log(`${isRebuild ? "Reb" : "B"}uilding...`);
|
||||
|
||||
// clear destination folder
|
||||
@@ -227,7 +229,7 @@ module.exports = async (config) => {
|
||||
},
|
||||
pages = files
|
||||
.map(({ page }) => ({ ...page }))
|
||||
.filter(({ is_draft }) => !is_draft)
|
||||
.filter(({ is_draft, status }) => !is_draft && status !== "draft")
|
||||
.sort(sortByPubDate),
|
||||
tagCloud = pages.reduce((acc, curr) => {
|
||||
const { tags } = curr;
|
||||
|
Reference in New Issue
Block a user