|
|
@ -42,7 +42,7 @@ export function createMarkdownToVueRenderFn(
|
|
|
|
const pageData: PageData = {
|
|
|
|
const pageData: PageData = {
|
|
|
|
title: inferTitle(frontmatter, content),
|
|
|
|
title: inferTitle(frontmatter, content),
|
|
|
|
description: inferDescription(frontmatter),
|
|
|
|
description: inferDescription(frontmatter),
|
|
|
|
frontmatter: withHeadDescriptionRemoved(frontmatter),
|
|
|
|
frontmatter: frontmatter,
|
|
|
|
headers: data.headers,
|
|
|
|
headers: data.headers,
|
|
|
|
relativePath: file.replace(/\\/g, '/'),
|
|
|
|
relativePath: file.replace(/\\/g, '/'),
|
|
|
|
lastUpdated
|
|
|
|
lastUpdated
|
|
|
@ -130,25 +130,3 @@ const getHeadMetaContent = (
|
|
|
|
|
|
|
|
|
|
|
|
return meta && meta[1].content
|
|
|
|
return meta && meta[1].content
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function isMetaDescription(headConfig: HeadConfig) {
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
headConfig[0] === 'meta' &&
|
|
|
|
|
|
|
|
headConfig[1] &&
|
|
|
|
|
|
|
|
headConfig[1].name === 'description'
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function rejectHeadDescription(head: HeadConfig[]) {
|
|
|
|
|
|
|
|
return head.filter((h: HeadConfig) => !isMetaDescription(h))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function withHeadDescriptionRemoved(frontmatter: Record<string, any>) {
|
|
|
|
|
|
|
|
if (frontmatter.head) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
...frontmatter,
|
|
|
|
|
|
|
|
head: rejectHeadDescription(frontmatter.head)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return frontmatter
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|