@ncwidgets/id

0.9.0 • Public • Published

ID Widget for NetlifyCMS

A widget for netlify-cms to generate ID for items in a list, or entries of a folder collection.


Unstable: Under active development

Installation

npm i @ncwidgets/id

Demo

In the demo below, the categories field is loaded from a file collection.

Live demo

Register

import cms from 'netlify-cms-app'
import { Widget as IdWidget } from '@ncwidgets/id'

cms.registerWidget(IdWidget)

cms.init()

How to use

Example config

collections:
  - label: Posts
    label_singular: Post
    name: posts
    folder: _posts
    create: true
    fields:
      - label: ID
        name: id

        # Default widget name
        widget: ncw-id
        
        # <Optional> If specified, add a prefix, i.e post-dnfuHvOhP
        prefix: post

        # <Optional> If `true`, add timestamp, i.e post-1588747959991-dnfuHvOhP
        # This can be used to sort collection by creation time
        timestamp: false

        # <Optional> Hide the widget from UI
        # Beware: We literally add `display: none` to the DOM node wrapping the input. It will break if netlifyCMS's editor pane structure changes.
        hidden: false

Contribute

Found a bug or a missing feature? Please feel free to send over a PR, or open an issue with the bug or enhancement tag.

Readme

Keywords

none

Package Sidebar

Install

npm i @ncwidgets/id

Weekly Downloads

449

Version

0.9.0

License

MIT

Unpacked Size

6.26 kB

Total Files

7

Last publish

Collaborators

  • d4rek