Skip to content

Commit

Permalink
Updated homepage empty slug documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Scheibel committed Nov 21, 2022
1 parent a684351 commit 5273b6c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Filament [plugin page](https://filamentphp.com/plugins/title-with-slug-permalink
- [Custom unique validation rules for title (and slug)](#custom-unique-validation-rules-for-title-and-slug)
- [Custom slugifier](#custom-slugifier)
- [Dark Mode](#dark-mode)
- [How to set a empty homepage slug](#how-to-set-a-empty-homepage-slug)
- [Use within a relationship repeater](#use-within-a-relationship-repeater)
- [Use the slug as subdomain](#use-the-slug-as-subdomain)
- [Package config file - Set default values](#package-config-file---set-default-values)
Expand Down Expand Up @@ -349,6 +350,25 @@ output looks like this:
<img src="docs/examples/camya-filament-title-with-slug_example_dark-mode_01.png" width="600" />
<img src="docs/examples/camya-filament-title-with-slug_example_dark-mode_02.png" width="600" />

### How to set a empty homepage slug

To set an empty slug, you must first remove the slug's `required` rule. You can do this by overwriting the `slugRules` array.

```php
\Camya\Filament\Forms\Components\TitleWithSlugInput::make(
slugRules: [],
),
```

In the input field of the component's slug form, use the `/` character to set the home page.

> The `/` character is necessary to bypass the **auto slug-regenerate** that would be triggered if the slug field is an empty string.
The input looks like this:

<img src="docs/examples/camya-filament-title-with-slug_example_homepage_01.png" width="600" />


### Use within a relationship repeater

You can use the TitleWithSlugInput inside a repeater with a database relation.
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 5273b6c

Please sign in to comment.