https://github.com/karolis-sh/netlify-cms-widget-pathname
Pathname input widget for Netlify CMS
https://github.com/karolis-sh/netlify-cms-widget-pathname
cms gatsby netlify netlify-cms pathname react url widget
Last synced: about 1 month ago
JSON representation
Pathname input widget for Netlify CMS
- Host: GitHub
- URL: https://github.com/karolis-sh/netlify-cms-widget-pathname
- Owner: karolis-sh
- License: mit
- Created: 2018-12-01T13:13:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-14T21:29:38.000Z (over 4 years ago)
- Last Synced: 2025-03-21T08:46:11.044Z (2 months ago)
- Topics: cms, gatsby, netlify, netlify-cms, pathname, react, url, widget
- Language: JavaScript
- Homepage: https://netlify-cms-widget-pathname.netlify.com
- Size: 1.89 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-decap-cms - netlify-cms-widget-pathname - Pathname input widget for Netlify CMS. (Custom Widget)
README
# netlify-cms-widget-pathname
[![npm version][version-badge]][version]

[![License: MIT][license-badge]][license]
[![code style: prettier][code-style-badge]][code-style]This widget provides pathname validation and URL preview. This might be handy if
you construct URL's based on input field. Check out [the demo](https://netlify-cms-widget-pathname.netlify.com/demo)!
## Install
```shell
npm i netlify-cms-widget-pathname
```or
```shell
yarn add netlify-cms-widget-pathname
```## Setup
```js
import { PathnameControl, PathnamePreview } from 'netlify-cms-widget-pathname';CMS.registerWidget('pathname', PathnameControl, PathnamePreview);
```## How to use
Add to your Netlify CMS configuration:
```yaml
fields:
- name: pathname
label: Page pathname
widget: pathname
```## Configuration
You can customize the preview of the URL with these options:
- `url_prefix` - add a prefix for the pathname
```yaml
fields:
- name: pathname
label: Page pathname
widget: pathname
url_prefix: /blog
```- `url_origin` - customize the URL's origin (default is `window.location.origin`)
```yaml
fields:
- name: pathname
label: Page pathname
widget: pathname
url_origin: https://github.com
```[version-badge]: https://badge.fury.io/js/netlify-cms-widget-pathname.svg
[version]: https://www.npmjs.com/package/netlify-cms-widget-pathname
[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
[license]: https://opensource.org/licenses/MIT
[code-style-badge]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg
[code-style]: https://github.com/prettier/prettier