Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows slugs to be empty #1513

Closed
wants to merge 1 commit into from
Closed

Allows slugs to be empty #1513

wants to merge 1 commit into from

Conversation

freshleafmedia
Copy link
Contributor

Description

This PR allows slugs to be empty. The use case being entities like a homepage.

I'm pretty new to the Twill Vue setup so not sure if the changes are how you would want to go about this.

I've marked this as a draft because I was unable to generate the dist assets. When I ran yarn build I got a large number of Syntax Error: TypeError: token.type.endsWith is not a function in files I haven't changed, what am I doing wrong?

@haringsrob
Copy link
Contributor

Hey @freshleafmedia,

Forgive me if I am mistaken, but I believe this is not needed.

You can set

class BlogController extends BaseModuleController
{
    protected $moduleName = 'blogs';

    protected $indexOptions = [
        'permalink' => false,
    ];
}

Then the field will not be shown.

@freshleafmedia
Copy link
Contributor Author

That would disable all permalinks for that model, what I want is to have permalinks which are optionally empty.

To expand on my use case a little, I have a Pages Capsule and each page has permalink except the homepage which I want to be just / aka an empty permalink

@kallefrombosnia
Copy link
Contributor

Interesant use case, but I think it's opinionated for the project.

I would create an additional checkbox with the 'Homepage' value, and in the repository, with the prepareFieldsBeforeSave method I would overwrite the permalink value to the / (quick fix).

It's really up to you to serve the homepage, Twill treats all slugs the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants