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

feat: automating og:image for getFrameHtmlResponse and FrameMetadata. #109

Merged
merged 6 commits into from
Feb 10, 2024

Conversation

Zizzamia
Copy link
Contributor

@Zizzamia Zizzamia commented Feb 9, 2024

// Set the image metadata if it exists.
const imageHtml = image ? ` <meta property="fc:frame:image" content="${image}" />\n` : '';
const imageHtml = ` <meta property="fc:frame:image" content="${image}" />\n`;
const ogImageHtml = ` <meta property="og:image" content="${image}" />\n`;
Copy link

@spennyp spennyp Feb 9, 2024

Choose a reason for hiding this comment

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

From my testing, og:title is also required to have warpcast render the frame from a GET response.
Can just set to empty string to satisfy this.

Copy link

Choose a reason for hiding this comment

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

Or, looks like they have some updated docs, and it seems maybe not necessary: https://docs.farcaster.xyz/reference/frames/spec#required-properties

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure i follow your point

Copy link

Choose a reason for hiding this comment

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

You added the og:image metadata here, but not og:title.

From my testing, without og:image AND og:title, warpcast won't render a frame from a GET request.

This works:

<!DOCTYPE html>
<html>
    <head>
	<meta property="og:image" content="https://paperclip.a.pinggy.link/images/nouns-auction-house.png" />
	<meta property="og:title" content="title" />
	<meta property="fc:frame" content="vNext" />
	<meta property="fc:frame:image" content="https://paperclip.a.pinggy.link/images/nouns-auction-house.png" />
	<meta property="fc:frame:post_url" content="https://paperclip.a.pinggy.link/auction/nouns?" />
	<meta property="fc:frame:button:1" content="View auction!" />
	<meta property="fc:frame:button:1:action" content="post" />
    </head>
</html>
    

This doesn't work (only difference is that it is missing the og:title tag)

<!DOCTYPE html>
<html>
    <head>
	<meta property="og:image" content="https://paperclip.a.pinggy.link/images/nouns-auction-house.png" />
	<meta property="fc:frame" content="vNext" />
	<meta property="fc:frame:image" content="https://paperclip.a.pinggy.link/images/nouns-auction-house.png" />
	<meta property="fc:frame:post_url" content="https://paperclip.a.pinggy.link/auction/nouns?" />
	<meta property="fc:frame:button:1" content="View auction!" />
	<meta property="fc:frame:button:1:action" content="post" />
    </head>
</html>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But the spec doesn't care about the title?!?

Is it the spec wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me loop back this to V

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But yeah, if it doesn't work, than yeah let me add og:title, and thank you for triple checking this.

Copy link

@spennyp spennyp Feb 9, 2024

Choose a reason for hiding this comment

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

Awesome, thanks!

Oh, and content="" (empty string) doesn't work lol (very finicky), so just put "title" or something if you are going to hardcode

Copy link

Choose a reason for hiding this comment

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

Sorry for the nits lol

This is the last thing stopping us from moving over to use onchainkit 🙏!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔 I guess is fair to let people decide, and than yeah maybe the default is something like Frame title

@Zizzamia
Copy link
Contributor Author

Zizzamia commented Feb 9, 2024

@spennyp random question.
when you say This doesn't work (only difference is that it is missing the og:title tag). Where it doesn't work, because I use that method with https://github.com/Zizzamia/a-frame-in-100-lines/blob/main/app/api/frame/route.ts#L28 and it works. Even without og:image and og:title stuff.

@spennyp
Copy link

spennyp commented Feb 9, 2024

@spennyp random question. when you say This doesn't work (only difference is that it is missing the og:title tag). Where it doesn't work, because I use that method with https://github.com/Zizzamia/a-frame-in-100-lines/blob/main/app/api/frame/route.ts#L28 and it works. Even without og:image and og:title stuff.

It’s when using getFrameHtmlResponse in a GET request instead of using page.tsx for the first response like here:
https://github.com/papercliplabs/frames/blob/main/src/app/auction/%5Bdao%5D/route.tsx#L6

@Zizzamia
Copy link
Contributor Author

@spennyp oh I see your point now! Ok give me a few minutes and I will finish and merge this PR.

@Zizzamia Zizzamia merged commit c5ee76d into main Feb 10, 2024
7 checks passed
@Zizzamia Zizzamia deleted the zizzamia/og-og-2-8 branch February 10, 2024 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants