diff --git a/quartz/components/pages/FolderContent.tsx b/quartz/components/pages/FolderContent.tsx index b00ea94..5aa7f09 100644 --- a/quartz/components/pages/FolderContent.tsx +++ b/quartz/components/pages/FolderContent.tsx @@ -23,9 +23,12 @@ function FolderContent(props: QuartzComponentProps) { allFiles: allPagesInFolder } + const desc = props.fileData.description + // @ts-ignore const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: 'html' }) return
+ {desc &&

{desc}

}
{content}

{allPagesInFolder.length} items under this folder.

diff --git a/quartz/components/pages/TagContent.tsx b/quartz/components/pages/TagContent.tsx index 81e8de2..bec66e3 100644 --- a/quartz/components/pages/TagContent.tsx +++ b/quartz/components/pages/TagContent.tsx @@ -17,9 +17,12 @@ function TagContent(props: QuartzComponentProps) { allFiles: allPagesWithTag } + const desc = props.fileData.description + // @ts-ignore const content = toJsxRuntime(tree, { Fragment, jsx, jsxs, elementAttributeNameCase: 'html' }) return
+ {desc &&

{desc}

}
{content}

{allPagesWithTag.length} items with this tag.

diff --git a/quartz/path.ts b/quartz/path.ts index a0fb223..0332584 100644 --- a/quartz/path.ts +++ b/quartz/path.ts @@ -60,8 +60,7 @@ export function relativeToRoot(slug: string, fp: string): string { } export function relative(src: string, dest: string): string { - return "./" + path.relative(src, dest) - + return path.relative(src, dest) } export const QUARTZ = "quartz" diff --git a/quartz/plugins/transformers/description.ts b/quartz/plugins/transformers/description.ts index cc20769..3505b19 100644 --- a/quartz/plugins/transformers/description.ts +++ b/quartz/plugins/transformers/description.ts @@ -31,7 +31,9 @@ export const Description: QuartzTransformerPlugin | undefined> let sentenceIdx = 0 const len = opts.descriptionLength while (finalDesc.length < len) { - finalDesc += sentences[sentenceIdx] + '.' + const sentence = sentences[sentenceIdx] + if (!sentence) break + finalDesc += sentence + '.' sentenceIdx++ } diff --git a/quartz/plugins/transformers/links.ts b/quartz/plugins/transformers/links.ts index b8a800a..03c8d43 100644 --- a/quartz/plugins/transformers/links.ts +++ b/quartz/plugins/transformers/links.ts @@ -1,5 +1,5 @@ import { QuartzTransformerPlugin } from "../types" -import { clientSideSlug, relativeToRoot, slugify, trimPathSuffix } from "../../path" +import { clientSideSlug, relative, relativeToRoot, slugify, trimPathSuffix } from "../../path" import path from "path" import { visit } from 'unist-util-visit' import isAbsoluteUrl from "is-absolute-url" @@ -31,8 +31,7 @@ export const CrawlLinks: QuartzTransformerPlugin | undefined> = const transformLink = (target: string) => { const targetSlug = slugify(decodeURI(target).trim()) if (opts.markdownLinkResolution === 'relative' && !path.isAbsolute(targetSlug)) { - // TODO - // return './' + relative(curSlug, targetSlug) + return './' + relative(curSlug, targetSlug) } else { return './' + relativeToRoot(curSlug, targetSlug) }