Skip to content

Commit eb24d94

Browse files
authored
Docs/embed feedback (#438)
* addedressed feedback * addedressed feedback * addedressed feedback * addedressed feedback
1 parent fc2e6db commit eb24d94

File tree

1 file changed

+64
-18
lines changed

1 file changed

+64
-18
lines changed

docs/mini-apps/core-concepts/embeds-and-previews.mdx

Lines changed: 64 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Embeds & Previews
3-
description: Mini apps use metadata to create embeds when users share links. The embed shows a preview image and launch button..
3+
description: Mini apps use metadata to create embeds when users share links. The embed shows a preview image and launch button.
44
---
55

66
<Panel>
@@ -11,23 +11,69 @@ description: Mini apps use metadata to create embeds when users share links. The
1111
## Implementation
1212
Add this meta tag to the `<head>` section of any page you want to make shareable:
1313

14-
```html metadata
15-
<!DOCTYPE html>
16-
<html lang="en">
17-
<head>
18-
<title>My Mini App</title>
19-
<meta name="fc:frame" content='{"version":"next","imageUrl":"https://example.com/preview.png","button":{"title":"Open App","action":{"type":"launch_frame","url":"https://example.com"}}}' />
20-
</head>
21-
<body>
22-
<!-- Your app content -->
23-
</body>
24-
</html>
25-
```
26-
Each page can have different metadata to create unique embeds.
27-
28-
<Tip>
29-
For Next.js projects, use the [Metadata API](https://nextjs.org/docs/app/building-your-application/optimizing/metadata) to generate the `fc:frame` meta tag dynamically.
30-
</Tip>
14+
<CodeGroup>
15+
```html html metadata
16+
<!DOCTYPE html>
17+
<html lang="en">
18+
<head>
19+
<title>My Mini App</title>
20+
<meta
21+
name="fc:miniapp"
22+
content='{
23+
"version": "next",
24+
"imageUrl": "https://example.com/preview.png",
25+
"button": {
26+
"title": "Open App",
27+
"action": {
28+
"type": "launch_frame",
29+
"url": "https://example.com"
30+
}
31+
}
32+
}'
33+
/>
34+
</head>
35+
<body>
36+
<!-- Your app content -->
37+
</body>
38+
</html>
39+
```
40+
41+
```jsx next.js metadata
42+
// app/layout.tsx or app/page.tsx (Next.js App Router)
43+
import type { Metadata } from "next";
44+
45+
export async function generateMetadata(): Promise<Metadata> {
46+
return {
47+
title: miniapp.name,
48+
description: miniapp.description,
49+
other: {
50+
"fc:miniapp": JSON.stringify({
51+
version: miniapp.version,
52+
imageUrl: miniapp.heroImageUrl,
53+
button: {
54+
title: `Join the ${miniapp.name}`,
55+
action: {
56+
name: `Launch ${miniapp.name}`,
57+
url: `${miniapp.homeUrl}`
58+
},
59+
},
60+
}),
61+
},
62+
};
63+
}
64+
65+
export default function RootLayout({ children }: { children: React.ReactNode }) {
66+
return (
67+
<html lang="en">
68+
<body>{children}</body>
69+
</html>
70+
);
71+
}
72+
```
73+
</CodeGroup>
74+
<Tip>The `homeUrl` used in the `manifest` *must* have embed metadata defined, in order for the mini app to render correctly in the Base app.</Tip>
75+
76+
3177

3278
## Schema
3379

0 commit comments

Comments
 (0)