22 lines
549 B
TypeScript
Raw Normal View History

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