Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined pageTitleSuffix causes thes string "undefined" to be appended to page titles #1452

Closed
LesleyLai opened this issue Sep 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@LesleyLai
Copy link

LesleyLai commented Sep 28, 2024

I encountered the same issue as #1445 after updating. The pageTitleSuffix variable is marked as optional so that the type checking won't prevent this issue.

Potential fix 1

This fix ensures that old codes without the pageTitleSuffix field in the configuration continue to work after the update.

quartz\components\Head.tsx

    const title =
-      (fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title) + cfg.pageTitleSuffix
+      (fileData.frontmatter?.title ?? i18n(cfg.locale).propertyDefaults.title) + (cfg.pageTitleSuffix ?? "")

Potential fix 2

This fix enforces the requirement to provide a pageTitleSuffix during type checking

quartz\cfg.ts

export interface GlobalConfiguration {
  pageTitle: string
-  pageTitleSuffix?: string
+  pageTitleSuffix: string
@LesleyLai LesleyLai added the bug Something isn't working label Sep 28, 2024
ChenghaoMou pushed a commit to ChenghaoMou/quartz that referenced this issue Oct 5, 2024
DronHazra pushed a commit to DronHazra/quartz that referenced this issue Oct 27, 2024
DronHazra pushed a commit to DronHazra/quartz that referenced this issue Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant