/ quartz / cfg.ts
cfg.ts
  1  import { ValidDateType } from "./components/Date"
  2  import { QuartzComponent } from "./components/types"
  3  import { ValidLocale } from "./i18n"
  4  import { PluginTypes } from "./plugins/types"
  5  import { Theme } from "./util/theme"
  6  
  7  export type Analytics =
  8    | null
  9    | {
 10        provider: "plausible"
 11        host?: string
 12      }
 13    | {
 14        provider: "google"
 15        tagId: string
 16      }
 17    | {
 18        provider: "umami"
 19        websiteId: string
 20        host?: string
 21      }
 22    | {
 23        provider: "goatcounter"
 24        websiteId: string
 25        host?: string
 26        scriptSrc?: string
 27      }
 28    | {
 29        provider: "posthog"
 30        apiKey: string
 31        host?: string
 32      }
 33    | {
 34        provider: "tinylytics"
 35        siteId: string
 36      }
 37    | {
 38        provider: "cabin"
 39        host?: string
 40      }
 41    | {
 42        provider: "clarity"
 43        projectId?: string
 44      }
 45    | {
 46        provider: "matomo"
 47        host: string
 48        siteId: string
 49      }
 50    | {
 51        provider: "vercel"
 52      }
 53    | {
 54        provider: "rybbit"
 55        siteId: string
 56        host?: string
 57      }
 58  
 59  export interface GlobalConfiguration {
 60    pageTitle: string
 61    pageTitleSuffix?: string
 62    /** Whether to enable single-page-app style rendering. this prevents flashes of unstyled content and improves smoothness of Quartz */
 63    enableSPA: boolean
 64    /** Whether to display Wikipedia-style popovers when hovering over links */
 65    enablePopovers: boolean
 66    /** Analytics mode */
 67    analytics: Analytics
 68    /** Glob patterns to not search */
 69    ignorePatterns: string[]
 70    /** Whether to use created, modified, or published as the default type of date */
 71    defaultDateType: ValidDateType
 72    /** Base URL to use for CNAME files, sitemaps, and RSS feeds that require an absolute URL.
 73     *   Quartz will avoid using this as much as possible and use relative URLs most of the time
 74     */
 75    baseUrl?: string
 76    theme: Theme
 77    /**
 78     * Allow to translate the date in the language of your choice.
 79     * Also used for UI translation (default: en-US)
 80     * Need to be formatted following BCP 47: https://en.wikipedia.org/wiki/IETF_language_tag
 81     * The first part is the language (en) and the second part is the script/region (US)
 82     * Language Codes: https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes
 83     * Region Codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
 84     */
 85    locale: ValidLocale
 86  }
 87  
 88  export interface QuartzConfig {
 89    configuration: GlobalConfiguration
 90    plugins: PluginTypes
 91  }
 92  
 93  export interface FullPageLayout {
 94    head: QuartzComponent
 95    header: QuartzComponent[]
 96    beforeBody: QuartzComponent[]
 97    pageBody: QuartzComponent
 98    afterBody: QuartzComponent[]
 99    left: QuartzComponent[]
100    right: QuartzComponent[]
101    footer: QuartzComponent
102  }
103  
104  export type PageLayout = Pick<FullPageLayout, "beforeBody" | "left" | "right">
105  export type SharedLayout = Pick<FullPageLayout, "head" | "header" | "footer" | "afterBody">