fix: missing home excerpt
This commit is contained in:
parent
c570c6a617
commit
664c2b0121
|
|
@ -8,8 +8,12 @@ export const remarkExcerpt: Plugin<Array<{ env: MarkdownEnv }>, Root> =
|
|||
(tree) => {
|
||||
for (const node of tree.children) {
|
||||
if (node.type === "paragraph") {
|
||||
env.excerpt = mdAstToString(node)
|
||||
break
|
||||
env.excerpt = mdAstToString(node, {
|
||||
includeImageAlt: false,
|
||||
}).slice(0, 140)
|
||||
if (env.excerpt) {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,36 +239,6 @@ export async function getPage<TRender extends boolean = false>(input: {
|
|||
throw notFound(`page ${input.page} not found`)
|
||||
}
|
||||
|
||||
if (pages?.list) {
|
||||
pages.list = await Promise.all(
|
||||
pages?.list.map(async (page) => {
|
||||
if (
|
||||
page.body?.content &&
|
||||
page.body?.mime_type === "text/markdown" &&
|
||||
input.render
|
||||
) {
|
||||
const rendered = await renderPageContent(page.body.content)
|
||||
page.body = {
|
||||
content: rendered.contentHTML,
|
||||
mime_type: "text/html",
|
||||
}
|
||||
if (!page.summary) {
|
||||
page.summary = {
|
||||
content: rendered.excerpt,
|
||||
mime_type: "text/html",
|
||||
}
|
||||
}
|
||||
}
|
||||
page.slug =
|
||||
page.attributes?.find((a) => a.trait_type === "xlog_slug")?.value ||
|
||||
page.metadata?.raw?._xlog_slug ||
|
||||
page.metadata?.raw?._crosslog_slug ||
|
||||
page.id
|
||||
return page
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
if (
|
||||
page.body?.content &&
|
||||
page.body?.mime_type === "text/markdown" &&
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ function SiteIndexPage({ domainOrSubdomain }: { domainOrSubdomain: string }) {
|
|||
take: 1000,
|
||||
type: "post",
|
||||
visibility: PageVisibilityEnum.Published,
|
||||
render: true,
|
||||
})
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue