Multi Language Same Slugs

Can someone give me an idea on how to achieve this. I'm building a multi language site and I want to have the same slugs for all languages. Default language should not have any base like below. Ex: www.sample.com/post-url www.sample.com/fr/post-url www.sample.con/es/post-url Is there any method i can call to get the data of a certain locale like, $page->forSlugWithLocale(slug, locale) Please help
1 Reply
ifox
ifox3w ago
Hi @Flash sorry for the delay, just seeing this. You can easily add your own scope for this, see the scopes that already ship with Twill here: https://github.com/area17/twill/blob/3.x/src%2FModels%2FBehaviors%2FHasSlug.php#L69-L76 In your particular case I would likely disable the permalink field, since you don't want it translated even though it is in a translated model. Then i would add a simple text field for the slug (non translated) and use that to resolve the article, which can load the correct translation depending on the active locale.
GitHub
twill/src/Models/Behaviors/HasSlug.php at 3.x · area17/twill
Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/c...
Want results from more Discord servers?
Add your server