fix: hide page content by default when getting pages

This commit is contained in:
EGOIST
2022-05-28 17:20:09 +08:00
parent 2124753096
commit cfc41fe2fd
3 changed files with 23 additions and 5 deletions
+12
View File
@@ -150,6 +150,8 @@ export async function getPagesBySite(
visibility?: PageVisibilityEnum | null
take?: number | null
cursor?: string | null
includeContent?: boolean
includeExcerpt?: boolean
},
) {
const site = await getSite(input.site)
@@ -204,7 +206,17 @@ export async function getPagesBySite(
const nodesRendered = await Promise.all(
nodes.slice(0, take).map(async (node) => {
if (!input.includeContent && !input.includeExcerpt) {
return node
}
const rendered = await renderPageContent(node.content)
if (!input.includeContent) {
rendered.contentHTML = ""
}
if (!input.includeExcerpt) {
rendered.excerpt = ""
node.excerpt = ""
}
return {
...node,
autoExcerpt: rendered.excerpt,