diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx index f81ad1d04..d0d7c5980 100644 --- a/quartz/components/Head.tsx +++ b/quartz/components/Head.tsx @@ -2,7 +2,7 @@ import { i18n } from "../i18n" import { FullSlug, joinSegments, pathToRoot } from "../util/path" import { CSSResourceToStyleElement, JSResourceToScriptElement } from "../util/resources" import { getFontSpecificationName, googleFontHref } from "../util/theme" -import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" +import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import satori, { SatoriOptions } from "satori" import { loadEmoji, getIconCode } from "../util/emoji" import fs from "fs" @@ -15,7 +15,7 @@ import { unescapeHTML } from "../util/escape" * @param opts options for generating image */ async function generateSocialImage( - { cfg, description, fileName, fontsPromise, title, fileData }: ImageOptions, + { cfg, description, fileName, fontsPromise, title, fileData }: ImageOptions, userOpts: SocialImageOptions, imageDir: string, ) { @@ -25,7 +25,7 @@ async function generateSocialImage( // JSX that will be used to generate satori svg const imageComponent = userOpts.imageStructure(cfg, userOpts, title, description, fonts, fileData) - const svg = await satori(imageComponent, { + const svg = await satori(imageComponent, { width, height, fonts, @@ -66,7 +66,7 @@ export default (() => { externalResources, ctx, }: QuartzComponentProps) => { - // Initialize options if not set + // Initialize options if not set if (!fullOptions) { if (typeof cfg.generateSocialImages !== "boolean") { fullOptions = { ...defaultOptions, ...cfg.generateSocialImages } @@ -147,7 +147,7 @@ export default (() => { // Use default og image if filePath doesnt exist (for autogenerated paths with no .md file) const useDefaultOgImage = fileName === undefined || !cfg.generateSocialImages - // Path to og/social image (priority: frontmatter > generated image (if enabled) > default image) + // Path to og/social image (priority: frontmatter > generated image (if enabled) > default image) let ogImagePath = useDefaultOgImage ? ogImageDefaultPath : ogImageGeneratedPath // TODO: could be improved to support external images in the future @@ -171,20 +171,9 @@ export default (() => { return (