npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spencercooley/strapi-plugin-og-pretty-link

v1.0.2

Published

A custom field plugin for the strapi block bulider that takes a link and saves it's open graph metadata so you can style a pretty content card on your frontend.

Readme

Strapi Plugin: Open Graph Pretty Link

A custom field for Strapi that allows content editors to fetch Open Graph data from a URL and save it as structured JSON. This enables you to easily create beautiful, data-rich preview cards in your frontend application.

Preview of the OG Pretty Link custom field in the Strapi admin panel

Features

  • Easy to Use: Simply paste a URL and click "Fetch".
  • Rich Data: Fetches OG title, description, image, and more.
  • Live Preview: Shows a preview of the card directly in the Content Manager.
  • Developer Friendly: Saves clean JSON data to your content type.

Requirements

  • Strapi v5.12.5 or higher
  • Node.js v18 or higher

1. Installation

In your Strapi project, install the plugin from npm:

npm install @spencercooley/strapi-plugin-og-pretty-link

2. Plugin Configuration

Enable the plugin in your Strapi project by creating or editing the file config/plugins.ts:

// file: config/plugins.ts
export default {
  'og-pretty-link': {
    enabled: true,
  },
};

3. Security Middleware Configuration

For the image previews in the admin panel to work correctly, you must update your application's Content Security Policy (CSP). This is because the OG images can come from any website.

In config/middlewares.ts, modify the strapi::security middleware to allow images from any http: or https: source:

// file: config/middlewares.ts
export default [
  'strapi::logger',
  'strapi::errors',
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          // Allow images from any source for previews
          'img-src': ["'self'", 'data:', 'blob:', 'https://market-assets.strapi.io', 'http:', 'https:'],
        },
      },
    },
  },
  'strapi::cors',
  'strapi::poweredBy',
  'strapi::query',
  'strapi::body',
  'strapi::session',
  'strapi::favicon',
  'strapi::public',
];

After configuring the plugin and middleware, rebuild your admin panel and restart the server:

npm run build
npm run develop

4. Usage (Schema Definition)

While you can add the field via the Content-Type Builder UI, it is recommended to define it directly in your schemas for version control and consistency.

Option A: Add as a Component in a Dynamic Zone (Recommended)

This is the most flexible approach, allowing you to add link previews anywhere in your content.

Step 1: Create the Component Schema

Create a new file at src/components/shared/og-link.json.

Important: Strapi components are organized into categories based on the folder structure inside src/components. In this case, shared is the category name. This allows you to organize your components logically (e.g., shared, page_sections, marketing).

// file: src/components/shared/og-link.json
{
  "collectionName": "components_shared_og_links",
  "info": {
    "displayName": "OG Link",
    "icon": "link",
    "description": "A component to fetch and display Open Graph link previews."
  },
  "options": {},
  "attributes": {
    "data": {
      "type": "customField",
      "customField": "plugin::og-pretty-link.og-link"
    }
  }
}

Step 2: Add the Component to a Dynamic Zone

In your Content Type's schema (e.g., src/api/article/content-types/article/schema.json), add the newly created component to your dynamiczone's components array.

Notice how "shared.og-link" directly maps to the folder and file you created (shared/og-link.json).

// file: src/api/article/content-types/article/schema.json
{
  // ... other schema properties
  "attributes": {
    // ... other attributes
    "blocks": {
      "type": "dynamiczone",
      "components": [
        "shared.media",
        "shared.quote",
        "shared.rich-text",
        "shared.og-link" // <-- Add this line
      ]
    }
  }
}

Option B: Add as a Standalone Field

If you don't need a dynamic zone, you can add the field directly to any content type's schema.json:

// file: src/api/my-content-type/content-types/my-content-type/schema.json
{
  // ... other schema properties
  "attributes": {
    // ... other attributes
    "my_link_preview": {
      "type": "customField",
      "customField": "plugin::og-pretty-link.og-link"
    }
  }
}

After defining your schemas, restart your Strapi server. The "OG Link" field will now be available in your content editor.