Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use dynamic og image for posts #33

Merged
merged 10 commits into from
Jan 9, 2025
Merged

Conversation

Shane98c
Copy link
Member

@Shane98c Shane98c commented Dec 18, 2024

Required for completion of: carbonplan/blog#143

@Shane98c Shane98c requested a review from katamartin January 7, 2025 20:54
Copy link
Member

@katamartin katamartin left a comment

Choose a reason for hiding this comment

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

This is looking good to me!

If I'm interpreting correctly, you've very tactfully scoped these changes so that they're non-breaking, which is great. One small export-naming question (the main thing I could imagine "breaking" in the future), otherwise looks good to go!

src/og/index.js Outdated
@@ -0,0 +1 @@
export { BlogPostOG, getBlogPostFonts } from './blog-post'
Copy link
Member

Choose a reason for hiding this comment

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

If we set up the same thing for research commentary, could we just directly reuse getBlogPostFonts ? In that case should we call it something more generic, like getOGFonts()?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah this had a smell to it. I coupled it like this in case other cards need more or less fonts, but it's clunky.

I've just refactored quite a bit to create a reusable font fetch function and to couple the fonts with the card component, so /blog doesn't need to import or deal with font fetching, but we can still configure exactly which fonts we need on a per-card basis (eg if research only uses 2/3 for example).

@@ -179,3 +153,28 @@ export const BlogPostOG = ({ title, date, authors, forceWrapAuthors }) => {
</div>
)
}

export const getBlogPostCard = async ({
Copy link
Member

Choose a reason for hiding this comment

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

Nice ✨

@Shane98c Shane98c merged commit 9f248ed into main Jan 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants