diff --git a/quartz/util/path.ts b/quartz/util/path.ts index dceb89bfa..c02bfb12d 100644 --- a/quartz/util/path.ts +++ b/quartz/util/path.ts @@ -168,6 +168,9 @@ export function resolveRelative(current: FullSlug, target: FullSlug | SimpleSlug export function splitAnchor(link: string): [string, string] { let [fp, anchor] = link.split("#", 2) + if (fp.endsWith(".pdf")) { + return [fp, anchor === undefined ? "" : `#${anchor}`] + } anchor = anchor === undefined ? "" : "#" + slugAnchor(anchor) return [fp, anchor] }