Skip to content

Commit

Permalink
woops
Browse files Browse the repository at this point in the history
  • Loading branch information
maxphillipsdev committed Aug 12, 2023
1 parent 4301d8b commit 28515a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/layouts/BlogPost.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ type Props = CollectionEntry<"blog">["data"] & { slug: string };
const { title, description, pubDate, updatedDate, heroImage, slug } =
Astro.props;
export const buildOGURL = (title: string | undefined) => {
export const buildOGURL = (slug: string | undefined) => {
const url = new URL("https://image.memp.dev/api");
title && url.searchParams.set("title", `/${slug}`);
slug && url.searchParams.set("title", `/${slug}`);
return url.toString();
};
---
Expand All @@ -19,7 +19,7 @@ export const buildOGURL = (title: string | undefined) => {
<article class="flex w-full flex-col items-center gap-6">
{title && <h1 class="text-center text-4xl font-bold">{title}</h1>}
<img
src={heroImage || buildOGURL(title)}
src={heroImage || buildOGURL(slug)}
alt=""
class="mb-6 w-full rounded-xl shadow-lg md:max-w-4xl"
/>
Expand Down
6 changes: 1 addition & 5 deletions src/pages/blog/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ const post = Astro.props;
const { Content } = await post.render();
---

<BlogPost
{...post.data}
slug={post.slug}
heroImage={buildOGURL(post.data.title)}
>
<BlogPost {...post.data} slug={post.slug} heroImage={buildOGURL(post.slug)}>
<Content />
<script
src="https://utteranc.es/client.js"
Expand Down

1 comment on commit 28515a8

@vercel
Copy link

@vercel vercel bot commented on 28515a8 Aug 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.