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

Remove locale automatically from slug #187

Closed
jkevingutierrez opened this issue Aug 21, 2020 · 1 comment
Closed

Remove locale automatically from slug #187

jkevingutierrez opened this issue Aug 21, 2020 · 1 comment

Comments

@jkevingutierrez
Copy link

jkevingutierrez commented Aug 21, 2020

Found a bug, please fill out the sections below

Issue summary

When you create a translated page, it always add the locale code to the slug. Is there a way to remove the locale code by default?

I'll explain my use case. I have something like this:

/   (TranslatableSiteRootPage)
    en/        (TransHomePage)
        english-page-1/    (TransLandingPage)

    es/        (TransHomePage)
        spanish-page-1/     (TransLandingPage)

Having WAGTAILTRANS_SYNC_TREE = true when I create an English page, it automatically creates the Spanish version.

The problem is that the Slug of the generated Spanish pages contains -es at the end. I would end up having pages like mysite.com/es/page-es/subpage-es. I know that I can edit manually the Slug of the page to remove the language code. But it would be great to have an easy way to remove the language code in the slug by default, specially if you need to create a lot of new pages of different types.

Maybe using a settings variable and do some validations here:

slug = '%s-%s' % (self.slug, language.code)

How to reproduce?

Following https://www.accordbox.com/blog/how-support-multi-language-wagtail-cms/

Technical details

Python 3.8
Django==3.0.9
wagtail==2.10
wagtailtrans==2.1

@jkevingutierrez
Copy link
Author

jkevingutierrez commented Aug 21, 2020

Duplicated of #178

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