diff --git a/quartz/util/og.tsx b/quartz/util/og.tsx index 683f71bd1..c8ad663b9 100644 --- a/quartz/util/og.tsx +++ b/quartz/util/og.tsx @@ -6,6 +6,8 @@ import { JSXInternal } from "preact/src/jsx" import { FontSpecification, ThemeKey } from "./theme" import path from "path" import { QUARTZ } from "./path" +import { formatDate } from "../components/Date" +import { getDate } from "../components/Date" const defaultHeaderWeight = [700] const defaultBodyWeight = [400] @@ -173,71 +175,92 @@ export const defaultImage: SocialImageOptions["imageStructure"] = ( fonts: SatoriOptions["fonts"], fileData: QuartzPluginData, ) => { - const fontBreakPoint = 22 + const fontBreakPoint = 32 const useSmallerFont = title.length > fontBreakPoint const iconPath = `https://${cfg.baseUrl}/static/icon.png` + // Format date if available + const rawDate = getDate(cfg, fileData) + const date = rawDate ? formatDate(rawDate, cfg.locale) : null + + // Get tags if available + const tags = fileData.frontmatter?.tags ?? [] + return (
{description}