Get in touch

About This Project

OpenGraph Embed Generator

Overview

The CDN Embed Service is a serverless application designed to wrap raw image URLs into a metadata-rich HTML container. This ensures that when an image link is shared across platforms like Discord, Twitter, or Slack, it is rendered as a high-quality embedded card rather than a standard hyperlink.

Purpose and Functionality

Direct links to image files often lack the necessary instructions for social media bots to display them correctly. This service solves that by acting as an intermediary layer.

By passing an image URL through this worker, the system generates a temporary HTML page populated with OpenGraph and Twitter Card meta tags. This process allows for:
* Enhanced Visual Presentation: Forcing platforms to display images in a large format.
* Consistent Branding: Standardizing titles and theme colors across all shared links.
* Improved UX: Providing a clean, distraction-free viewing environment for users who click the link.

Implementation Details

The service utilizes a Cloudflare Worker to intercept incoming GET requests. It extracts the destination image URL from the query string and injects it into a pre-defined HTML template.

  1. Parameter Parsing: The worker identifies the "url" parameter within the request.
  2. Metadata Injection: It dynamically populates the og:image and twitter:image tags.
  3. Response Delivery: The worker returns a response with the text/html header, signaling to web crawlers that the link contains rich media information.
  4. Interface Styling: The response includes an internal CSS stylesheet that centers the image and applies a dark theme to ensure a professional look upon manual navigation.

Usage

To generate an embed, the image URL must be appended to the worker endpoint as a query parameter:
https://[worker-url]/?url=[image-link]

Technologies Used

JavaScript Cloudflare Workers OpenGraph Twitter Card Protocols