From 921f45cf7001a6af77cd0bf10f7fbf154eebabff Mon Sep 17 00:00:00 2001
From: threehymns <70611435+threehymns@users.noreply.github.com>
Date: Wed, 25 Sep 2024 00:20:36 +0000
Subject: [PATCH] feat: add a config option for a pageTitleSuffix (#1320)
---
docs/configuration.md | 1 +
quartz/cfg.ts | 1 +
quartz/components/Head.tsx | 3 ++-
quartz.config.ts | 1 +
4 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/docs/configuration.md b/docs/configuration.md
index 1dc1148..302d067 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -21,6 +21,7 @@
This part of the configuration concerns anything that can affect the whole site. The following is a list breaking down all the things you can configure:
- `pageTitle`: title of the site. This is also used when generating the [[RSS Feed]] for your site.
+- `pageTitleSuffix`: a string added to the end of the page title. This only applies to the browser tab title, not the title shown at the top of the page.
- `enableSPA`: whether to enable [[SPA Routing]] on your site.
- `enablePopovers`: whether to enable [[popover previews]] on your site.
- `analytics`: what to use for analytics on your site. Values can be
diff --git a/quartz.config.ts b/quartz.config.ts
index b6abbb2..e96ee48 100644
--- a/quartz.config.ts
+++ b/quartz.config.ts
@@ -9,6 +9,7 @@
const config: QuartzConfig = {
configuration: {
pageTitle: "🪴 Quartz 4.0",
+ pageTitleSuffix: "",
enableSPA: true,
enablePopovers: true,
analytics: {
diff --git a/quartz/cfg.ts b/quartz/cfg.ts
index 0c344d3..9e93fd1 100644
--- a/quartz/cfg.ts
+++ b/quartz/cfg.ts
@@ -41,6 +41,7 @@
export interface GlobalConfiguration {
pageTitle: string
+ pageTitleSuffix?: string
/** Whether to enable single-page-app style rendering. this prevents flashes of unstyled content and improves smoothness of Quartz */
enableSPA: boolean
/** Whether to display Wikipedia-style popovers when hovering over links */
diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx
index 46ba5e0..7b9815c 100644
--- a/quartz/components/Head.tsx
+++ b/quartz/components/Head.tsx
@@ -6,7 +6,8 @@
export default (() => {
const Head: QuartzComponent = ({ cfg, fileData, externalResources }: QuartzComponentProps) => {
- const title = fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title
+ const title =
+ (fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title) + cfg.pageTitleSuffix
const description =
fileData.description?.trim() ?? i18n(cfg.locale).propertyDefaults.description
const { css, js } = externalResources
--
Gitblit v1.10.0