Skip to content

Commit dac5c97

Browse files
Change og to jpg
1 parent a11bf5d commit dac5c97

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

src/layouts/BlogPost.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import "../styles/shiki-highlight.css"
55
import BaseHead from "../components/BaseHead.astro"
66
import BlogPost from "../components/BlogPost.astro"
77
import BaseTopOfBody from "src/components/BaseTopOfBody.astro"
8+
import path from "path"
89
910
const { content } = Astro.props
1011
const {
@@ -20,7 +21,7 @@ const url = Astro.request.url
2021

2122
<html lang={content.lang || "en"}>
2223
<head>
23-
<BaseHead {title} {description} permalink={url} image="/og.webp" />
24+
<BaseHead {title} {description} permalink={url} image={new URL(`${Astro.url.pathname}/og.jpg`, Astro.url).toString()} />
2425
</head>
2526

2627
<body>
File renamed without changes.

src/pages/index.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ interface MarkdownFrontmatter {
2020
// All variables are available to use in the HTML template below.
2121
let title = "Web Dev Simplified Blog"
2222
let description = "In depth articles with interactive examples about every web dev topic."
23-
let permalink = "https://blog.webdevsimplified.com"
2423
2524
// Data Fetching: List all Markdown posts in the repo.
2625
@@ -42,15 +41,13 @@ const allPosts = allMarkdownPosts
4241
return bDate - aDate
4342
})
4443
45-
const url = Astro.request.url
46-
4744
// Full Astro Component Syntax:
4845
// https://docs.astro.build/core-concepts/astro-components/
4946
---
5047

5148
<html lang="en">
5249
<head>
53-
<BaseHead {title} {description} {permalink} image="/og.webp" />
50+
<BaseHead {title} {description} permalink={Astro.url.toString()} image={new URL("/og.jpg", Astro.url).toString()} />
5451

5552
<style>
5653
.content {
File renamed without changes.

src/utils/generateOpenGraphImage.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export async function generateOpenGraphImage({
164164
satoriOptions,
165165
)
166166

167-
const webp = await sharp(Buffer.from(svg)).webp({ quality: 100 }).toBuffer()
167+
const jpg = await sharp(Buffer.from(svg)).jpeg({ quality: 100 }).toBuffer()
168168

169-
return new Response(webp, { headers: { "Content-Type": "image/webp" } })
169+
return new Response(jpg, { headers: { "Content-Type": "image/jpg" } })
170170
}

0 commit comments

Comments
 (0)