Skip to content

Commit

Permalink
Fix mismerge
Browse files Browse the repository at this point in the history
Signed-off-by: Leonardo Ledda <[email protected]>
  • Loading branch information
LeddaZ committed Nov 18, 2024
1 parent 16a1c60 commit fd71a57
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
34 changes: 32 additions & 2 deletions quartz/components/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,38 @@ export default (() => {
const path = url.pathname as FullSlug
const baseDir = fileData.slug === "404" ? path : pathToRoot(fileData.slug!)

const iconPath = joinSegments(baseDir, "static/icon.svg")
const ogImagePath = `https://${cfg.baseUrl}/static/og-image.png`
const iconPath = joinSegments(baseDir, "static/icon.png")

const ogImageDefaultPath = `https://${cfg.baseUrl}/static/og-image.png`
// "static/social-images/slug-filename.md.webp"
const ogImageGeneratedPath = `https://${cfg.baseUrl}/${fileDir.replace(
`${ctx.argv.output}/`,
"",
)}/${fileName}.${extension}`

// 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)
let ogImagePath = useDefaultOgImage ? ogImageDefaultPath : ogImageGeneratedPath

// TODO: could be improved to support external images in the future
// Aliases for image and cover handled in `frontmatter.ts`
const frontmatterImgUrl = fileData.frontmatter?.socialImage

// Override with default og image if config option is set
if (fileData.slug === "index") {
ogImagePath = ogImageDefaultPath
}

// Override with frontmatter url if existing
if (frontmatterImgUrl) {
ogImagePath = `https://${cfg.baseUrl}/static/${frontmatterImgUrl}`
}

// Url of current page
const socialUrl =
fileData.slug === "404" ? url.toString() : joinSegments(url.toString(), fileData.slug!)

return (
<head>
Expand Down
Binary file added quartz/static/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion quartz/static/icon.svg

This file was deleted.

0 comments on commit fd71a57

Please sign in to comment.