| | |
| | | import { i18n } from "../i18n" |
| | | import { FullSlug, joinSegments, pathToRoot } from "../util/path" |
| | | import { JSResourceToScriptElement } from "../util/resources" |
| | | import { CSSResourceToStyleElement, JSResourceToScriptElement } from "../util/resources" |
| | | import { googleFontHref } from "../util/theme" |
| | | import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | |
| | | export default (() => { |
| | | const Head: QuartzComponent = ({ cfg, fileData, externalResources }: QuartzComponentProps) => { |
| | | const titleSuffix = cfg.pageTitleSuffix ?? "" |
| | | const title = |
| | | (fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title) + cfg.pageTitleSuffix |
| | | (fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title) + titleSuffix |
| | | const description = |
| | | fileData.description?.trim() ?? i18n(cfg.locale).propertyDefaults.description |
| | | const { css, js } = externalResources |
| | |
| | | <link rel="icon" href={iconPath} /> |
| | | <meta name="description" content={description} /> |
| | | <meta name="generator" content="Quartz" /> |
| | | {css.map((href) => ( |
| | | <link key={href} href={href} rel="stylesheet" type="text/css" spa-preserve /> |
| | | ))} |
| | | {css.map((resource) => CSSResourceToStyleElement(resource, true))} |
| | | {js |
| | | .filter((resource) => resource.loadTime === "beforeDOMReady") |
| | | .map((res) => JSResourceToScriptElement(res, true))} |