What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a SvelteKit +server.ts route to return an image generated with the ImageResponse API from the Sveltekit OG library, then point each page’s Open Graph metadata at that route’s public, absolute URL. For a finite set of pages whose content is available during the build, prerender the image routes; use runtime generation when image content depends on request-time data or cannot be enumerated at build time.

How the image route and page metadata fit together

An Open Graph image is the visual asset a social or messaging service can use in a shared-link preview. Generating the image is only half the setup: the page’s HTML must also identify the image through its Open Graph metadata, and the image URL must be publicly accessible.

The implementation below uses the ImageResponse API documented by the Sveltekit OG library. It is not a native SvelteKit image-generation API. The library describes ImageResponse as extending the standard Web Response, and its documented example uses a Svelte component, dimensions, and font data. See the Sveltekit OG documentation for the current API and setup details.

  1. Create an image-specific server route such as src/routes/og/[slug].png/+server.ts.
  2. Load the page record for the requested slug and return a not-found response if it does not exist.
  3. Pass the record’s title and other card data to a Svelte component through ImageResponse.
  4. Set the image dimensions and provide any custom font as binary data.
  5. Put the absolute image URL in the corresponding page’s Open Graph metadata.

The library’s documentation includes a +server.ts example and shows export const prerender = true as an optional setting. Check its current installation instructions and API reference before using the illustrative code below; package setup and exact helper signatures are library-specific.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Build the card as a Svelte component

Keep the visual design separate from the route’s data lookup. The component receives page-specific values as props, so one card design can serve many pages. For example, save this as src/lib/OgCard.svelte:

<script lang="ts">
  export let title: string;
  export let description: string;
</script>

<div style="display:flex; flex-direction:column; justify-content:space-between; width:100%; height:100%; padding:64px; background:#101827; color:white; font-family:Inter;">
  <div style="font-size:24px; opacity:0.8;">Example site</div>
  <div>
    <div style="font-size:64px; font-weight:700; line-height:1.1;">{title}</div>
    <div style="margin-top:20px; font-size:28px; opacity:0.85;">{description}</div>
  </div>
</div>

This is a design starting point, not a guarantee that every browser CSS feature or client-side asset behavior is supported by the image renderer. Test the component’s styles and output in the selected library and hosting runtime.

Return an image from a dynamic SvelteKit route

Place a route at src/routes/og/[slug].png/+server.ts. The route must look up real page data rather than silently creating a generic image for an invalid slug. The following illustrates the route shape; adapt the data lookup, font loader, and exact ImageResponse constructor options to the installed Sveltekit OG version and your project:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
import { ImageResponse } from '@ethercorps/sveltekit-og';
import OgCard from '$lib/OgCard.svelte';
import type { RequestHandler } from './$types';
import { getArticleBySlug } from '$lib/server/articles';
import { loadFont } from '$lib/server/og-font';

export const GET: RequestHandler = async ({ params }) => {
  const article = await getArticleBySlug(params.slug);
  if (!article) {
    return new Response('Not found', { status: 404 });
  }

  const fontData = await loadFont();
  return new ImageResponse(
    OgCard,
    {
      props: {
        title: article.title,
        description: article.description
      },
      width: 1200,
      height: 630,
      fonts: [
        {
          name: 'Inter',
          data: fontData,
          weight: 400,
          style: 'normal'
        }
      ]
    }
  );
};

getArticleBySlug and loadFont above are application helpers, not SvelteKit or Sveltekit OG built-ins. Implement the former against your content store and have the latter return the font file as raw binary data such as an ArrayBuffer. The library documentation provides font helpers for loading and resolving fonts; follow its current API for the precise font object shape and response options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The library’s API documentation uses 1200 × 630 pixels in an example. Treat that as the library example’s dimensions, not as a universal platform requirement. Choose dimensions for your target presentation and confirm the renderer produces the expected format and layout.

Point each page’s Open Graph metadata at its image

For a page with slug getting-started, the image endpoint might resolve to https://example.com/og/getting-started.png. Use that full public URL in the page’s metadata. In a SvelteKit page server load, for example, return the URL alongside the page data and render the tags in the page head:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
<script lang="ts">
  export let data: {
    article: { title: string; description: string; slug: string };
    ogImageUrl: string;
  };
</script>

<svelte:head>
  <meta property="og:title" content={data.article.title} />
  <meta property="og:description" content={data.article.description} />
  <meta property="og:type" content="article" />
  <meta property="og:image" content={data.ogImageUrl} />
</svelte:head>

Construct ogImageUrl from the canonical public origin and the encoded slug, or use the canonical URL strategy already established by your application. Check the rendered HTML for the exact page URL: metadata generated only in the browser may not be present when a preview crawler fetches the page. The endpoint and the metadata must agree, and the image route must be reachable without a session or private network access.

Choose runtime generation or build-time prerendering

Approach Best fit What to account for
Runtime generation Content or image data that depends on request-time state, or a route set that cannot be enumerated at build time. The server generates the response when requested. Decide how caching, revalidation, and changes to mutable content should work. No universal performance or cost advantage is established by the library documentation.
Build-time prerendering A finite, known collection of image paths whose source content is available during the build. Enable prerendering for the route and define the dynamic route entries so the build can produce each image. New or changed content requires a build to update the generated output.

The library documentation describes export const prerender = true and defining entries for dynamic paths as the build-time pattern. A route that cannot supply its path list and underlying data during the build is not a fit for that pattern without changing how content is provided. The decision is about freshness and whether the build can enumerate the required outputs, not a documented numeric threshold.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fonts, images, and deployment compatibility

  • Fonts: Provide custom fonts as raw binary data, such as an ArrayBuffer. A browser font declaration alone does not give a server-side image renderer the font file.
  • Local assets: Browser-relative paths and client assets are not automatically available to server-side rendering. Supply local image data directly, for example as a data URL, or use a public absolute URL accessible to the renderer.
  • Renderer support: Verify the component’s CSS, font handling, asset loading, and output format with the chosen image library. Do not assume browser rendering behavior is reproduced.
  • Adapter and runtime: SvelteKit adapters convert build output for deployment platforms. Confirm that the selected renderer and its dependencies work in the target adapter and runtime; no provider-by-provider compatibility result is established here.
  • Mutable data: Choose cache headers and an invalidation or revalidation approach that matches how often the source page changes. The library material does not establish a single cache policy.

Troubleshoot common failures

The route returns 404 or the wrong card

Check the URL’s slug, the route parameter name, and the content lookup. Return a not-found status when the record is absent instead of generating a plausible but incorrect fallback image. For prerendered routes, confirm the slug is included in the build’s entries and its data is available at build time.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

The image URL works in a browser, but the preview has no image

Inspect the page’s served HTML and confirm og:image contains the exact absolute, publicly reachable image URL. Fetch the image URL without relying on a logged-in browser session, and make sure the endpoint returns an image response rather than an HTML error page. Also check that the page itself exposes its metadata in the HTML delivered to the preview crawler.

The font is missing or text wraps unexpectedly

Confirm the font is loaded as binary data and passed using the library’s current font option format. Check the font family name used by the card, then test long titles and descriptions; dynamic copy can wrap differently from the short sample used during design.

A logo or background image is absent

Replace browser-relative asset paths with data supplied directly to the renderer or an absolute URL it can access. If the asset is remote, verify it is publicly reachable from the rendering environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

The route works locally but fails after deployment

Check adapter output and target runtime support for the renderer and its dependencies, then review how the deployment environment resolves font and image assets. SvelteKit’s adapter documentation explains the role of adapters, but the cited materials do not provide a compatibility matrix for individual hosts.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test the complete share-preview path

  1. Open a real content page and inspect its served HTML for og:title, og:description, and og:image.
  2. Copy the image URL from og:image and request it directly. Confirm it returns the intended image for that page’s slug.
  3. Try a nonexistent slug and confirm the endpoint returns not found rather than a misleading card.
  4. Test representative short and long titles, any custom fonts and assets, and the deployed—not just local—route.
  5. If prerendering, build with the complete intended route set and verify that the generated paths are present in the deployment output.
  6. Set and test caching behavior according to how quickly page content needs to appear in a regenerated image.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server, not an Open Graph image-generation library: use the SvelteKit route above when you need a designed, page-specific social card. If you also need a clean screenshot of a rendered web page, one GET request can return an image or PDF:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for parameters and setup. It accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server includes take_screenshot, get_page_info, and capture_pdf for AI agents. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for free ScreenshotNeo access.

Frequently Asked Questions

Does SvelteKit generate Open Graph images natively?

The implementation here uses the third-party Sveltekit OG library’s ImageResponse API in a SvelteKit server route; it is not a native SvelteKit image-generation API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use the same Svelte component for every page’s image?

Yes. Define the card once and pass page-specific title, description, or other data as props when creating each image response.

Does ScreenshotNeo create these dynamic Open Graph cards?

No. ScreenshotNeo captures rendered web pages; use the SvelteKit image route and metadata for designed, page-specific Open Graph cards.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.