Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docs/content/docs/1.guides/6.v1-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,21 @@ GA4 has [known issues](https://github.com/BuilderIO/partytown/issues/583) with P

### SSR Social Embeds

Render X and Instagram embeds server-side without loading third-party JavaScript.
Render X, Instagram, and Bluesky embeds server-side without loading third-party JavaScript.

Enable the embeds you need in your `nuxt.config`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
scripts: {
registry: {
xEmbed: true,
instagramEmbed: true,
blueskyEmbed: true,
},
},
})
```

```vue
<ScriptXEmbed tweet-id="1754336034228171055">
Expand Down
18 changes: 17 additions & 1 deletion docs/content/scripts/bluesky-embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ Nuxt Scripts provides a [`<ScriptBlueskyEmbed>`{lang="html"}](/scripts/bluesky-e
::script-types
::

## Setup

To use the Bluesky embed component, you must enable it in your `nuxt.config`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
scripts: {
registry: {
blueskyEmbed: true,
},
},
})
```

This registers the required server API routes (`/_scripts/embed/bluesky` and `/_scripts/embed/bluesky-image`) that handle fetching post data and proxying images.

## [`<ScriptBlueskyEmbed>`{lang="html"}](/scripts/bluesky-embed){lang="html"}

The [`<ScriptBlueskyEmbed>`{lang="html"}](/scripts/bluesky-embed){lang="html"} component is a headless component that:
Expand Down Expand Up @@ -253,7 +269,7 @@ interface SlotProps {

1. **Server-side fetch**: The server fetches post data from `public.api.bsky.app` (AT Protocol) during SSR
2. **Handle resolution**: The server resolves handles to DIDs for reliable post lookup
3. **Image proxying**: The server rewrites all images to proxy through `/api/_scripts/bluesky-embed-image`
3. **Image proxying**: The server rewrites all images to proxy through `/_scripts/embed/bluesky-image`
4. **Rich text**: The component converts Bluesky facets (links, mentions, hashtags) to HTML
5. **Caching**: The server caches responses for 10 minutes
6. **No client-side API calls**: The user's browser never contacts Bluesky directly
Expand Down
16 changes: 16 additions & 0 deletions docs/content/scripts/google-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ to install the `@types/google.maps` dependency.
pnpm add -D @types/google.maps
```

## Setup

To use the Google Maps component with server-side features (static map proxy, geocode proxy), enable it in your `nuxt.config`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
scripts: {
registry: {
googleMaps: true,
},
},
})
```

This registers server API routes for the static maps image proxy (`/_scripts/proxy/google-static-maps`) and geocode proxy (`/_scripts/proxy/google-maps-geocode`), keeping your API key server-side.

## [`<ScriptGoogleMaps>`{lang="html"}](/scripts/google-maps){lang="html"}

The [`<ScriptGoogleMaps>`{lang="html"}](/scripts/google-maps){lang="html"} component is a wrapper around the [`useScriptGoogleMaps()`{lang="ts"}](/scripts/google-maps){lang="ts"} composable. It provides a simple way to embed Google Maps in your Nuxt app.
Expand Down
16 changes: 16 additions & 0 deletions docs/content/scripts/instagram-embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ Nuxt Scripts provides a [`<ScriptInstagramEmbed>`{lang="html"}](/scripts/instagr
::script-types
::

## Setup

To use the Instagram embed component, you must enable it in your `nuxt.config`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
scripts: {
registry: {
instagramEmbed: true,
},
},
})
```

This registers the required server API routes (`/_scripts/embed/instagram`, `/_scripts/embed/instagram-image`, and `/_scripts/embed/instagram-asset`) that handle fetching embed HTML and proxying images/assets.

## [`<ScriptInstagramEmbed>`{lang="html"}](/scripts/instagram-embed){lang="html"}

The [`<ScriptInstagramEmbed>`{lang="html"}](/scripts/instagram-embed){lang="html"} component:
Expand Down
18 changes: 17 additions & 1 deletion docs/content/scripts/x-embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ Nuxt Scripts provides a [`<ScriptXEmbed>`{lang="html"}](/scripts/x-embed){lang="
::script-types
::

## Setup

To use the X embed component, you must enable it in your `nuxt.config`:

```ts [nuxt.config.ts]
export default defineNuxtConfig({
scripts: {
registry: {
xEmbed: true,
},
},
})
```

This registers the required server API routes (`/_scripts/embed/x` and `/_scripts/embed/x-image`) that handle fetching tweet data and proxying images.

## [`<ScriptXEmbed>`{lang="html"}](/scripts/x-embed){lang="html"}

The [`<ScriptXEmbed>`{lang="html"}](/scripts/x-embed){lang="html"} component is a headless component that:
Expand Down Expand Up @@ -161,7 +177,7 @@ interface SlotProps {
## How It Works

1. **Server-side fetch**: Tweet data is fetched from `cdn.syndication.twimg.com` during SSR
2. **Image proxying**: All images are rewritten to proxy through `/api/_scripts/x-embed-image`
2. **Image proxying**: All images are rewritten to proxy through `/_scripts/embed/x-image`
3. **Caching**: Responses are cached for 10 minutes at the server level
4. **No client-side API calls**: The user's browser never contacts X directly

Expand Down
4 changes: 4 additions & 0 deletions playground/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export default defineNuxtConfig({
debug: true,
registry: {
googleSignIn: true,
blueskyEmbed: true,
xEmbed: true,
instagramEmbed: true,
googleMaps: true,
},
},
})
Loading
Loading