Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Ladylain/slugfield
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladylain committed Jul 3, 2024
2 parents 46c789f + 3a1cf8e commit c2cfed6
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# slugfield
# SlugField Plugin for OctoberCMS
SlugField is a form widget plugin for OctoberCMS. It provides a user-friendly way to generate URL slugs for your content.

## Features
* Easy to use: Simply add the SlugField widget to your form and start generating slugs.
* URL validation: SlugField ensures that the generated slug is a valid URL.
* Customizable: You can easily customize the appearance of the SlugField widget with CSS.
* Dynamic page linking: You can use the `page('name', 'param')` function to generate a link to a specific OctoberCMS page.
## Usage
To use the SlugField widget in your form, add it to your fields.yaml file:
```yaml
fields:
title:
label: title
type: text
slug:
label: Slug
type: slugfield
link: 'https://yourdomain.com'
preset:
type: slug
field: title
```
The link attribute is optional. If provided, it will be used as the base URL for the generated slug preview.
You can also use the `page('name', 'param')` function as the value of the link attribute to generate a link to a specific OctoberCMS page. For example:
```yaml
fields:
title:
label: title
type: text
slug:
label: Slug
type: slugfield
link: "page('blog', 'slug')"
preset:
type: slug
field: title
```
In this example, the `page('blog', 'slug')` function will generate a link to the 'blog' page with the slug as a parameter.

The slug is not saved directly when it is regenerated, so it is necessary to remember to save the form to keep it.

## Contributing
Contributions are welcome! Please submit a pull request with any enhancements, fixes, or features.

## License
This project is licensed under the MIT License. See the LICENSE file for details.


0 comments on commit c2cfed6

Please sign in to comment.