2023-08-17 05:04:15 +00:00
|
|
|
import { canonicalizeServer, pathToRoot } from "../util/path"
|
2023-06-12 06:46:38 +00:00
|
|
|
import { QuartzComponentConstructor, QuartzComponentProps } from "./types"
|
2023-06-08 05:27:32 +00:00
|
|
|
|
2023-07-01 20:35:27 +00:00
|
|
|
function PageTitle({ fileData, cfg }: QuartzComponentProps) {
|
|
|
|
const title = cfg?.pageTitle ?? "Untitled Quartz"
|
2023-07-16 06:02:12 +00:00
|
|
|
const slug = canonicalizeServer(fileData.slug!)
|
2023-07-13 07:19:35 +00:00
|
|
|
const baseDir = pathToRoot(slug)
|
2023-07-23 00:27:41 +00:00
|
|
|
return (
|
|
|
|
<h1 class="page-title">
|
|
|
|
<a href={baseDir}>{title}</a>
|
|
|
|
</h1>
|
|
|
|
)
|
2023-06-08 05:27:32 +00:00
|
|
|
}
|
2023-06-12 06:46:38 +00:00
|
|
|
|
2023-07-01 20:35:27 +00:00
|
|
|
PageTitle.css = `
|
|
|
|
.page-title {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
`
|
2023-06-18 17:47:07 +00:00
|
|
|
|
2023-07-01 20:35:27 +00:00
|
|
|
export default (() => PageTitle) satisfies QuartzComponentConstructor
|