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

directus-extension-slug-generator

v1.0.2

Published

Hierarchical slug generator for Directus — auto-generates slugs with parent chain resolution, accent-safe slugify, inline editing, and live preview

Downloads

389

Readme

@grupo-jpp/directus-extension-permalink-generator

A Directus 11.x interface extension that merges the best features of two open-source projects into a single, production-ready permalink generator with full accent support.

Built by merging:


Features

| Feature | Description | | ------------------------------- | --------------------------------------------------------------- | | 🔤 Accent-safe slugify | Uses @sindresorhus/slugifyvestuáriovestuario ✅ | | 🌳 Hierarchical parents | Resolves parent chain recursively → bicicletas/mtb/29er | | ⚡ Auto-generation | Watches form values; auto-generates on create and/or update | | 🔗 Clickable link preview | Displays full URL as a clickable link in preview mode | | ✏️ Inline editing | Click ✏️ to edit; Enter confirms, Escape cancels | | 🎨 Micromustache template | Source field defined via {{ name }}, {{ title }}, etc. | | 📐 Dynamic prefix/suffix | /, https://site.com/, .html — supports template variables | | 🔄 "Generate URL" button | Force full regeneration including hierarchy resolution | | 🔒 Circular reference guard | Detects and prevents infinite parent loops | | 🆙 Directus 11.x compatible | Built for host: ^11.0.0 |


Installation

Via npm

npm i directus-extension-slug-generator

Then copy the dist/ folder into your Directus extensions directory:

extensions/
└── interfaces/
    └── jpp-permalink-generator/
        └── index.js   ← dist/index.js

Build from source

git clone https://github.com/grupo-jpp/directus-extension-permalink-generator.git
cd directus-extension-permalink-generator
npm install
npm run build
# Copy dist/ to your Directus extensions/interfaces/ folder

Configuration

After installing, add the interface to any string field in your Directus collection. The following options are available:

| Option | Type | Default | Description | | --------------------- | ---------- | ------------ | ------------------------------------------------------------------------ | | template | string | (required) | Micromustache template to generate the slug source. E.g. {{ name }} | | parentRelationField | string | '' | Field name of the M2O parent relation. Leave empty for flat slugs. | | prefix | string | / | URL prefix. Supports template variables. E.g. / or https://site.com/ | | suffix | string | '' | URL suffix. E.g. / or .html | | placeholder | string | '' | Placeholder text shown when the field is empty | | iconLeft | string | — | Directus icon name displayed on the left | | update | string[] | ['create'] | When to auto-generate: 'create', 'update', or both |


Usage Examples

Flat slug (no parent hierarchy)

Configuration:

  • Template: {{ name }}
  • Prefix: /
  • Parent Relation Field: (empty)

Result:

| Input name | Generated permalink | | ---------------------- | ----------------------- | | Vestuário | /vestuario | | Bicicletas Elétricas | /bicicletas-eletricas | | Café com Leite | /cafe-com-leite | | ñoño | /nono | | über cool | /uber-cool |


Hierarchical slug (with parent resolution)

Configuration:

  • Template: {{ name }}
  • Prefix: /
  • Parent Relation Field: parent

Collection structure:

Bicicletas (id: 1, parent: null)
└── MTB (id: 2, parent: 1)
    └── 29er (id: 3, parent: 2)

Result:

| Item | Generated permalink | | ------------ | ---------------------- | | Bicicletas | /bicicletas | | MTB | /bicicletas/mtb | | 29er | /bicicletas/mtb/29er |


Custom prefix and suffix

Configuration:

  • Prefix: https://shop.example.com/
  • Suffix: /

Result: https://shop.example.com/bicicletas/mtb/29er/


Accent Handling

This extension uses @sindresorhus/slugify which properly normalizes Unicode characters before removing diacritics:

| Input | Output | Notes | | ---------------------- | ---------------------- | -------------------------- | | vestuário | vestuario | ✅ áa (NOT removed) | | bicicletas elétricas | bicicletas-eletricas | ✅ | | café com leite | cafe-com-leite | ✅ | | ñoño | nono | ✅ ñn | | über cool | uber-cool | ✅ üu | | São Paulo | sao-paulo | ✅ |

⚠️ The original letrthang/directus-cms-permalink-generator used a regex [^\w\-]+ which removed accented characters instead of converting them. This extension fixes that bug.


Keyboard Shortcuts (Inline Edit Mode)

| Key | Action | | -------- | --------------------------------- | | Enter | Confirm edit | | Escape | Cancel and restore previous value |


Development

npm install
npm run dev   # watch mode with sourcemaps
npm run build # production build

Credits

This extension is a merge of two excellent open-source projects:


License

MIT © Grupo JPP