getkirby / ideas

This is the backlog of ideas and feature requests from the last two years. Use our new feedback platform to post your new ideas or vote on existing ideas.
https://feedback.getkirby.com
20 stars 0 forks source link

Panel: support setting `'url' => '/'` for default language #444

Open jnetzlr opened 4 years ago

jnetzlr commented 4 years ago

It doesn't make sense to add the language code to the url of the default language.

As in example.fr/fr where French is the default language, it doesn't look good to me. Neither does example.com/en where English is the default.

bastianallgeier commented 4 years ago

That's just the default. You can set the path to something custom for each language or you can decide to remove it.

I.e.

// site/languages/en.php
return [
  ...
  'url' => '/'
];
texnixe commented 4 years ago

@bastianallgeier I think this whole idea should be really about making this a config setting via the Panel, e.g. when you create the default language, make it possible to decide whether the default language should have a language code or not. Currently, it needs someone to go into the language files to make this change. So I wouldn't say this should be a default setting, but maybe configurable in the dialog?

jnetzlr commented 4 years ago

Agree, definitely a setting in the panel would be great.

Also in terms of SEO, it's not great. If you turn your example.com site into a multi-lang environment, suddenly it's example.com/en by default. And yes it's a simple change in the php file but I'm thinking of users that doesn't code much or at all, that uses the panel instead.

lukasbestle commented 4 years ago

We could have a checkbox for this in the dialog of the default language.

neildaniels commented 4 years ago

The inability to create a default language without the code in the URL is annoying to me. Planning on migrating a production site to a multi-lang setup soon.

Realistically, all of my languages are going to be manually defined and I won't use the Panel to manage languages at all. However, the fact that the Panel will migrate content files is incredibly useful. In theory, it means I can switch the site over while it's still in production.

But, because the the default language will suddenly have (in this case) /en prepended to all the URLs (which I don't want), makes this a nonviable method. Instead, I'm basically compelled to copy all of the content beforehand, migrate the content files (either manually invoking the converter() function or by using the Panel on a staging site), then replacing the production content and code.

lukasbestle commented 4 years ago

@neildaniels I don't understand. This issue only deals with the feature idea to introduce a way to configure the language paths from the Panel. The manual way to change the one line in your default language's PHP file already works. There's nothing else you need to do.

neildaniels commented 4 years ago

I'm saying there is literally no way to have zero downtime on a site where you want to convert to multi-lang and keep the new/default language URLs the same as the original.

For example, assume you start with 0 languages. And a URL looks like example.com/news.

Then you use the Panel to add your first language (lets say English). That same URL now becomes something like example.com/en/news.

Note: You cannot simply add a /languages/en.php file to your installation, because all of your content files need to be migrated over.

So, assuming you use the Panel to add English, you then have to immediately go and modify the language file to change the url value to /. But there is still some period where your site is producing undesirable URLs.

Being able to create your first language with / as the url in the Panel eliminates all of this and makes transitioning hassle-free and nearly instant.

texnixe commented 4 years ago

@neildaniels When you look at it from a superficial perspective, you seem to be right. But honestly I think there is a lot more to adding new languages than an editor pressing a button. While the Panel makes it easy to add new languages, and does the converting of the content, I sincerely doubt that the work is done with that. Usually, adding new languages involves a lot more effort and should probably not be left to an editor.

If we look at all these tasks, then adding the 3 seconds to change the URL in the language file doesn't seem to be the real problem.

neildaniels commented 4 years ago

100% agree, but you can do all of that after the initial migration (except for backing up and testing changes). Once the Panel is used to simultaneously migrate content files and enable multi-lang, you can then go through that list at your leisure. (Since I'm just talking about setting up the default language, all of your code/HTML/strings are almost certainly in the correct language anyways.)

Again, I'm saying the trickiest step is simultaneously migrating content files AND enabling multi-language. If you do either step independently, you break your Kirby setup until the 2nd step is complete.

I'm merely pointing out that if I could modify the URL value when creating the first language, the Panel becomes incredibly powerful for people who want to migrate and keep the default language URLs the same.