File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
packages/astro-theme/layouts Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import BlogPostCardSet from "../components/BlogPostCardSet.astro";
1212import { resolveAuthors } from " ../lib/blog" ;
1313import LinkButton from " ../components/LinkButton.astro" ;
1414import { DISCORD_URL } from " ../consts" ;
15- import { Image } from " astro:assets" ;
15+ import { Image , getImage } from " astro:assets" ;
1616import { productFromUrl } from " ../lib/products" ;
1717import ProductNav from " ../components/nav/product/Nav.astro" ;
1818
@@ -33,14 +33,25 @@ let titleAndSubtitle = title;
3333if (subtitle ) {
3434 titleAndSubtitle += ` : ${subtitle } ` ;
3535}
36+
37+ // Generate optimized social preview image using the same optimization as the hero image
38+ const socialImage = heroImage
39+ ? await getImage ({
40+ src: heroImage ,
41+ width: 1232 ,
42+ height: 480 ,
43+ quality: " max" ,
44+ format: " jpg" ,
45+ })
46+ : undefined ;
3647---
3748
3849<Shell
3950 title ={ titleAndSubtitle }
4051 {description }
41- image ={ heroImage ?.src }
42- imageWidth ={ heroImage ? .width }
43- imageHeight ={ heroImage ? .height }
52+ image ={ socialImage ?.src }
53+ imageWidth ={ socialImage ?. attributes .width }
54+ imageHeight ={ socialImage ?. attributes .height }
4455>
4556 { product && <ProductNav { product } />}
4657 <main class =" px-6 py-10 w-full max-w-screen-xl mx-auto" >
You can’t perform that action at this time.
0 commit comments