From 0c199975f2d469ecdfd7efcf2ddd16ffa1dc492b Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 17 Aug 2023 07:55:28 +0000
Subject: [PATCH] various path fixes for links to extensions, fix relative paths in links
---
quartz/components/PageTitle.tsx | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/quartz/components/PageTitle.tsx b/quartz/components/PageTitle.tsx
index 080b74d..c1e74f3 100644
--- a/quartz/components/PageTitle.tsx
+++ b/quartz/components/PageTitle.tsx
@@ -1,9 +1,21 @@
-import { resolveToRoot } from "../path"
-import { QuartzComponentProps } from "./types"
+import { canonicalizeServer, pathToRoot } from "../util/path"
+import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
-export default function({ cfg, fileData }: QuartzComponentProps) {
- const title = cfg.siteTitle
- const slug = fileData.slug!
- const baseDir = resolveToRoot(slug)
- return <h1><a href={baseDir}>{title}</a></h1>
+function PageTitle({ fileData, cfg }: QuartzComponentProps) {
+ const title = cfg?.pageTitle ?? "Untitled Quartz"
+ const slug = canonicalizeServer(fileData.slug!)
+ const baseDir = pathToRoot(slug)
+ return (
+ <h1 class="page-title">
+ <a href={baseDir}>{title}</a>
+ </h1>
+ )
}
+
+PageTitle.css = `
+.page-title {
+ margin: 0;
+}
+`
+
+export default (() => PageTitle) satisfies QuartzComponentConstructor
--
Gitblit v1.10.0