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

Imported slug gets ignored and generated from title instead #25

Open
tobiv opened this issue Sep 5, 2023 · 1 comment
Open

Imported slug gets ignored and generated from title instead #25

tobiv opened this issue Sep 5, 2023 · 1 comment

Comments

@tobiv
Copy link

tobiv commented Sep 5, 2023

I can't get the slug to import, even when I disable the Generate option in the Slug field of the collection blueprint. It always gets overwritten with a slug generated from the title. Is this something Statamic does after the import?

@tobiv
Copy link
Author

tobiv commented Sep 5, 2023

I solved it by amending the if-statement on line 169 in src/Jobs/ImportJob.php:

if ($this->collection->requiresSlugs()) {
    if (!empty($data->get('slug'))) {
         $entry->slug($data->get('slug'));
    }
    else {
        $entry->slug(Str::slug($data->get('title')));
    }
}

While that is not thoroughly tested, it worked for my specific case.

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

No branches or pull requests

1 participant