diff --git a/quartz/util/og.tsx b/quartz/util/og.tsx index b64ce7c..ca0005e 100644 --- a/quartz/util/og.tsx +++ b/quartz/util/og.tsx @@ -6,9 +6,6 @@ import { JSXInternal } from "preact/src/jsx" import { FontSpecification, getFontSpecificationName, ThemeKey } from "./theme" import path from "path" import { QUARTZ } from "./path" -import { formatDate, getDate } from "../components/Date" -import readingTime from "reading-time" -import { i18n } from "../i18n" import { styleText } from "util" const defaultHeaderWeight = [700] @@ -186,29 +183,17 @@ export const defaultImage: SocialImageOptions["imageStructure"] = ({ title, description, deck, - section, - fileData, - iconBase64, imageBase64, }) => { const { colorScheme } = userOpts - const fontBreakPoint = 30 - const useSmallerFont = title.length > fontBreakPoint - - // Format date if available - const rawDate = getDate(cfg, fileData) - const date = rawDate ? formatDate(rawDate, cfg.locale) : null - - // Calculate reading time - const { minutes } = readingTime(fileData.text ?? "") - const readingTimeText = i18n(cfg.locale).components.contentMeta.readingTime({ - minutes: Math.ceil(minutes), - }) - - const bodyFont = getFontSpecificationName(cfg.theme.typography.body) - const headerFont = getFontSpecificationName(cfg.theme.typography.header) - const displayDeck = deck || description + const displayDeck = deck || description || title const showImage = Boolean(imageBase64) + const headerFont = getFontSpecificationName(cfg.theme.typography.header) + const bodyFont = getFontSpecificationName(cfg.theme.typography.body) + const chromeBackground = "rgba(0,0,0,0.25)" + const deckLength = displayDeck.length + const deckFontSize = + deckLength > 85 ? 24 : deckLength > 65 ? 27 : deckLength > 50 ? 30 : deckLength > 36 ? 34 : 40 return (
-
- {iconBase64 && ( - - )} -
- {cfg.pageTitle} -
-
- {section && ( -
- {section} -
- )} -
-
-
-

- {title} -

-
-
-

- {displayDeck} -

-
-
- {date && ( -
- - - - - - - {date} -
- )} -
- - - - - {readingTimeText} -
-
+ {displayDeck} +

diff --git a/quartz/util/social.ts b/quartz/util/social.ts index 97b10f7..cd3d4bd 100644 --- a/quartz/util/social.ts +++ b/quartz/util/social.ts @@ -161,15 +161,15 @@ export function resolveSocialDeck( return explicitDeck.trim() } + if (siteMetadata.deck && siteMetadata.deck.trim().length > 0) { + return siteMetadata.deck.trim() + } + const tagline = extractTopTagline(fileData.htmlAst) if (tagline) { return tagline } - if (siteMetadata.deck && siteMetadata.deck.trim().length > 0) { - return siteMetadata.deck.trim() - } - return description }