-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
[V4] UUID permalinks always redirect to default language page #5551
Comments
Permalinks could gain that we optionally add the language code at the end And then the link field would need to support that in multilingual setups. |
@lukasbestle What do you think of this idea to add language support to permalinks? Or do you have another idea? |
In theory, a UUID could contain a slash if a custom generator is used. This would then break the language code separated by a slash. But I think the UUID cache already doesn't work with slashes in UUIDs, right? If that's the case, I agree with your suggestion. It's functional but also clean. |
Could also be |
That would already not have worked as the question mark would have ended the path parsed by PHP/our router. But to be honest, I think we can just ignore that potential issue I brought up. I think it's very unlikely that a) anyone actually built a custom UUID generator that b) uses slashes in the UUID and c) that worked at all before even with those slashes. The However the slash syntax is certainly cleaner if we can be sure that the syntax can stay like this. Adding more params to the end later would be a pain. |
Also, urls with params ( |
will this be fixed in the next rc?! |
I agree that this is an issue that should be solved before the production release. |
The issue exists for 3.9, yes, although 3.9 doesn't promote the usage of UUID permalinks in any way (hence it never got noticed) Now with v4, all Page Writer links are not absolute paths but the permalinks, and there is no way to select the other language with those. |
It's been 79 days since this issue got posted and it seems we're still stuck on the part of how to build the URL-structure; as @tobimori mentions to me it feels like a mandatory fix before the 4.0 Release will appear. Some suggestions, with the
|
@dviate doesn't help if we rush this and then are stuck with something dysfunctional. I get that it can be frustrating when you want this solved for your project, but pressure won't help the quality of a solution. I think there are two parts to this:
|
It'd be great if we get a Field method like |
@tobimori and that one just runs a regex on $page->myWriterField()->toResolvedUrls() |
I agree that an additional method to resolve permalinks is great. For the language issue I would suggest this:
In a multi-language installation, we could add another field to the link dialog to select the language for a link. By default, the field would be set to the currently selected language and the specific permalink is added. |
/**
* Converts permalinks in the field value to absolute urls
*/
'toResolvedUrls' => function (Field $field): Field {
if ($field->isNotEmpty() === true) {
$field->value = preg_replace_callback("$\/@\/(page|file)\/([^'\"]+)$", function ($matches) {
if ($uuid = Uuid::for($matches[1] . '://' . $matches[2])) {
return $uuid->model()->url();
}
return $matches[0];
}, $field->value);
}
return $field;
}, This would though match any other |
@distantnative I'd keep this pretty strict tbh. Ideally we could use the dom parser for this here to be sure that we only work on attributes. But I'm not sure what's more performant. |
@bastianallgeier you're right, went with parsing the DOM - it's not an operation that we do a thousands of times, so I think the strictness here outweighs any potential performance difference #5976 |
As mentioned a couple times before, this is tricky. We will mostly solve this now in RC.2 with the new |
Just out of curiosity: is there any news about this? 😃 |
@dviate we are still working on more UUID fixes. They are tricky. That's why we need longer than expected. Sorry for the wait. |
At least there's now a solution for the first part. Language-specifc routes: #6312 We will keep on it. |
@bastianallgeier First part finally done, I think the second part would be to return from |
Well, not quite. Cause the LinkField builds the URL itself. |
Description
When the languages are enabled, when you add a link to another page, the
@/page/uuid
-link is the same for every language.Expected behavior
When I'm on a page in any non-default language, for instance
site.com/es/sobre-nosotros/
, where the default page link will besite.com/about-us/
, I want to open the page in that language and not the default language.To reproduce
config.php
In your default language it works, when you open the Spanish version of the page and you click the link, it redirects you to the linked page in the default language. Editing the link on the Spanish version of the page doesn't help either.
Your setup
Kirby Version
4.0.0-alpha.7
Language files in
site/languages/
NL (for me)
ES (test)
The text was updated successfully, but these errors were encountered: