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 🙏

© 2024 – Pkg Stats / Ryan Hefner

sgezha-custom-slug

v2.1.1

Published

Auto Generated rewritable Slug field (same for different locales).

Downloads

5

Readme

Strapi plugin: slug


This plugin adds a Slug field to Strapi. Slug has autocomplete default generated value in format: post-year-month-day-hours-minutes-seconds, same for all locales.

Also we can add KeyWord and/or pattern, which will be used to generate slug.

There are next patterns:

  • keyword
  • title + keyword
  • id + keyword
  • datetime + keyword
  • title
  • id
  • datetime

Id generated automatically after clicking on button Save. If you don't choose any KeyWord or Pattern it's autofill field with datetime placeholder.

Instalation

Install the plugin in your Strapi project.

  • npm i custom-slug | npm
  • npm run build > npm run develop
  • go to admin > Content Type Builder > choose content type > click to button Add another field (to this collection type) > select tab CUSTOM > click on slug plugin tile > add name to field label > click on button finish > click on button save.
  • go to tab Advanced settings and check it off Enable localization for this field to FALSE (if it is TRUE/checked plugin generate unique value for every entry for all locales)

content-type-builder

Description

This is Slug Custom Field plugin which generate automatically rewritable values on entity creation, like: post-year-month-day-hours-minutes-seconds and saves the same value for all locales in slug.

  • autocomplete autofill uniq default value by title, entry id, current datetime and/or key word
  • same slug value to all locales
  • rewritable data
  • pattern by placeholder

Screenshots

demo1 demo2 demo4 demo5 demo3

Demo

watch


Цель

Нужно автозаполняемое поле slug, сохраняющее одно и то же значение для всех локалей. Текущие настройки UID не позволяют сохранять одно и тоже значение для разных языков.

Созданный плагин отображает поле CustomField Slug, которое:

  • автозаполненное со сгенерированными по паттерну значениями
  • редактируемое (вводимые значения с клавиатуры на уникальность не проверяются)
  • сохраняет одно и то же значение для всех локалей - автогенерируемые значения уникальны
  • автоподставляет значение из паттерна или если нажать переключатель - данные из поля title, если они присутствуют

Доступны следующие паттерны для генерации автозаполнения:

  • kw (key word - ключевое слово)
  • kw + title
  • kw + id
  • kw + datetime
  • title
  • id
  • datetime

По умолчанию, стоит datetime в формате: год-месяц-число-час-минуты-секунды. Если не указывать kw, то будут значения из паттернов title, id, datetime или же, если не выбрано ни kw ни pattern, будет значение "datetime". Поле по паттерну id автозаполняется после нажатия кнопки Сохранить в соответствующей коллекции Entry, это связано с спецификой Strapi, он присваивает значение ID, только после сохранения поста. Если включить чекбокс Enable localization, все значения будут уникальны и перегенерированны заново для каждой локали.

Slugify/URLize/генерация наименования ссылок:

Нашла, но не очень поняла, как Strapi конвертирует вводимые значения на кириллице в латиницу и убирает спец. символы. Например, тут отправляет запрос на /content-manager/uid/generate и получает ключ data с конвертированным значением. Не поняла, как достучаться до этого поля, чтоб были нужные значения, потому на Chat GPT сделала конвертер cyr-to-lat.

Похожие плагины:

Доработки:

  • убрать иконку и тайтл в админке в сайдбаре [ui]
  • расположить в ряд поля с настройками плагина (Kw + Pattern) [ui]
  • сделать проверку на уникальность/совпадения вводимых значений с клавиатуры [feature]