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

preview-button-multidomain

v1.0.0-beta.0

Published

Extends strapi-plugin-preview-button (https://www.npmjs.com/package/strapi-plugin-preview-button) for multiple domains and locales: map locale/slug to frontend hosts and replace {host}. Requires peer strapi-plugin-preview-button@^3. By BrainStation-23 / A

Readme

preview-button-multidomain

strapi-plugin-preview-button, extended for multiple domains and locales.

Keep using strapi-plugin-preview-button for Open draft preview / Copy link / live view. This package plugs into its plugin/preview-button/before-build-url hook so each entry’s locale (and optional slug) maps to the right frontend host — one domain for many locales, or a different domain per locale — by substituting {host} in your URL templates.

Depends on: strapi-plugin-preview-button@^3 (required peer; this package does not replace it).
Upstream source: mattmilburn/strapi-plugin-preview-button

Features

  • Extends strapi-plugin-preview-button — same buttons, multi-domain / multi-locale hosts
  • Map locales (and slugs) → frontend hosts via configurable domains[]
  • One host for several locales, or separate hosts per locale/market
  • Exact .env keys on domains[].env (no auto-prefix)
  • Optional defaultEnv when locale/slug do not match
  • Locale match first, then slug (slug can override); null-safe {host} replace
  • Single consumer config: contentTypes on this plugin, mirrored onto preview-button at bootstrap
  • Bundler-safe: server resolves env → URLs; admin fetches public config

Prerequisites

Install and enable strapi-plugin-preview-button first. This extender only chooses the host; without upstream, there are no preview buttons. Peer install does not auto-enable it in Strapi — both plugins must appear in config/plugins.

Install

Beta (current):

npm install preview-button-multidomain@beta strapi-plugin-preview-button@^3

Or pin: [email protected].

Source and issues: github.com/BrainStation-23/strapi-preview-multidomain-plugin. Releases: GitHub Releases.

Configure config/plugins

1. Primary example

Mix patterns in one domains list: one host for several languages (DACH), plus another host for English.

| URL part | Who covers it | | --- | --- | | Host | This plugin{host} from the matched domains row | | Path prefix (/de_DE/, /de_AT/, …) | Not this plugin{localePath} (or another mapped entry field) in the template | | Page slug | Upstream preview-button via {slug} |

// config/plugins.ts
export default ({ env }) => ({
  'preview-button-multidomain': {
    enabled: true,
    config: {
      domains: [
        {
          env: 'STRAPI_ADMIN_DOMAIN_DACH',
          locales: ['de-DE', 'de-AT', 'de-CH'],
          // host matching only — does NOT insert /de_AT/ into the URL
          slugs: ['de_DE', 'de_AT', 'de_CH'],
        },
        {
          env: 'STRAPI_ADMIN_DOMAIN_ENGLISH_1',
          locales: ['en-GB'],
          slugs: ['en'],
        },
      ],
      defaultEnv: 'STRAPI_ADMIN_DOMAIN_DACH',
      contentTypes: [
        {
          uid: 'api::page.page',
          draft: {
            // {host} = this plugin; {localePath}/{slug} = upstream/entry fields
            url: `{host}/{localePath}/{slug}?secret=${env('PREVIEW_SECRET')}&status=draft`,
          },
          published: {
            url: `{host}/{localePath}/{slug}`,
          },
        },
      ],
    },
  },

  // Required — npm dependency does not auto-enable Strapi plugins
  'preview-button': true,
});
STRAPI_ADMIN_DOMAIN_DACH=https://mydomain.com
STRAPI_ADMIN_DOMAIN_ENGLISH_1=https://english.example.com
PREVIEW_SECRET=your-preview-secret

Prefer STRAPI_ADMIN_* for admin-related hosts. There is no auto-prefix: env is the exact process.env key.

This plugin does not auto-convert de-AT/de_AT/.

Single locale, single slug (one language → one host):

{
  env: 'STRAPI_ADMIN_DOMAIN_GERMAN',
  locales: ['de-DE'],
  slugs: ['de_DE'],
},

2. More hosts (optional)

Add more rows the same way — each env is a different host:

domains: [
  {
    env: 'STRAPI_ADMIN_DOMAIN_DACH',
    locales: ['de-DE', 'de-AT', 'de-CH'],
    slugs: ['de_DE', 'de_AT', 'de_CH'],
  },
  {
    env: 'STRAPI_ADMIN_DOMAIN_ENGLISH_1',
    locales: ['en-GB'],
    slugs: ['en'],
  },
  {
    env: 'STRAPI_ADMIN_DOMAIN_FRENCH',
    locales: ['fr', 'fr-FR'],
    slugs: ['fr'],
  },
],
defaultEnv: 'STRAPI_ADMIN_DOMAIN_DEFAULT',
STRAPI_ADMIN_DOMAIN_DACH=https://mydomain.com
STRAPI_ADMIN_DOMAIN_ENGLISH_1=https://english.example.com
STRAPI_ADMIN_DOMAIN_FRENCH=https://french.example.com
STRAPI_ADMIN_DOMAIN_DEFAULT=https://www.example.com

Resolution rules

  1. Match data.locale against domains[].locales
  2. Then match data.slug against domains[].slugs (slug can override; host matching only — does not write path prefixes)
  3. Else use defaultEnv URL when set
  4. Missing env values are skipped (domain omitted); unmatched entries do not inject undefined into URLs

Dual-config fallback

If extender contentTypes is empty, contentTypes already configured on preview-button still work. Prefer the single extender config above.

Migration from preview-button-before-build

  1. Replace package / plugin key with preview-button-multidomain
  2. Move host selection into config.domains (+ defaultEnv) instead of hard-coded DE/AT/CH envs
  3. Move contentTypes onto this plugin’s config (optional but recommended)
  4. Keep 'preview-button': true

Develop

npm run build
npm run verify
npm test

Links

| | | | --- | --- | | Required dependency (npm) | strapi-plugin-preview-button (^3) | | Upstream source | mattmilburn/strapi-plugin-preview-button | | Issues | https://github.com/BrainStation-23/strapi-preview-multidomain-plugin/issues |


Organization: BrainStation-23
Author: Abu Sayed (Sayedbs / sayed021)
Repository: BrainStation-23/strapi-preview-multidomain-plugin
Release notes: RELEASE.md