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

strapi-relation-names

v1.3.1

Published

Display Strapi relations with clear, customizable labels built from your content fields

Readme

🔗 strapi-relation-names

Clear and customizable relation labels for Strapi v5

Display Strapi relations using readable labels built from your content fields instead of relying on the default relation name.

npm version Strapi Version License: MIT npm

Ever wanted to display a relation as custom text or with nested field values? This plugin solves exactly that:

Relation labels example


✨ Features

  • 🏷️ Custom relation labels
  • 🧩 Combine multiple fields in a single label
  • ✏️ Add static text around field values
  • 🔁 Supports repeated placeholders
  • 📦 Supports scalar fields such as strings, numbers, booleans, and dates
  • 🛡️ Falls back to Strapi's default relation label when necessary
  • 🔎 Keeps Strapi's existing relation search and sorting behavior
  • 🖥️ Admin-only — no changes to your Content API or stored data

🚀 Installation

Install via npm:

npm install strapi-relation-names

or yarn:

yarn add strapi-relation-names

or pnpm:

pnpm add strapi-relation-names

Enable the plugin:

// config/plugins.{js,ts}
'strapi-relation-names': {
  enabled: true,
},

Quickstart

After installing and enabling the plugin, open the Strapi Admin settings panel:

Settings → Global → Relation Names

Each relation field is displayed together with the scalar fields available on its related content type or component.

Create a label using placeholders e.g.:

{firstName} {lastName}

You can also mix placeholders with static text:

Name: {firstName} {lastName}

It is also possible to transform a label's value using pipe syntax: {createdAt | toLocalDateTime}

Currently the following transformations exist:

  • toLocalDate — formats date values using the configured locale and time zone.
  • toLocalDateTime — formats date-time values using the configured locale and time zone.

⚙️ Configuration

Possible configuration keys are listed below; omitted keys keep the plugin defaults.

| Key | Description | Possible values | | ------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------ | | collections | Limit relation names to the listed collection and single type UIDs. Leave empty to include all. | string[] (default: []) | | locale | Locale used by date transformations. | string (default: runtime locale) | | timeZone | IANA timezone used by date transformations. | string (default: runtime timezone) |

Example:

// config/plugins.{js,ts}
'strapi-relation-names': {
  enabled: true,
  config: {
    collections: ['api::article.article', 'api::author.author'],
    locale: 'de-AT',
    timeZone: 'Europe/Vienna',
  },
},

🗂️ How It Works

At runtime, the server-side plugin decorates Strapi Content Manager relation responses and field metadata. It reads the configured template, validates each placeholder against the related content type schema, and renders the label from the returned relation data. If a value is not present, it performs a permission-aware hydration query; nested component paths are loaded by populating their component root. The rendered label is then exposed through Strapi's normal relation display mechanism. Missing field values are replaced with an empty string.

For example:

{firstName} {lastName}

with a missing lastName becomes:

John

If the complete rendered label is blank, Strapi automatically falls back to its default relation label.

The default label is also used when:

  • No template is configured
  • The configured template is invalid
  • The rendered template contains no usable value

🔮 Planned Features

  • [ ] Live label previews while editing templates
  • [ ] Define default relation templates in plugin configuration
  • [x] Support nested field paths in templates
  • [x] Support nested relation fields in templates
  • [ ] Import and export relation-label settings
  • [ ] Conditional labels and configurable fallback rules
  • [x] Support label transformation functions

If you have any feature requests or suggestions, please open a dedicated issue.

🛑 Problems

If you encounter any issues, please feel free to open an issue on the GitHub repo.

🛠️ Contributing

Contributions are welcome! If you have suggestions or improvements, please open an issue or submit a pull request to the dev branch.