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

Unable to link a content across various languages #15498

Closed
wtct opened this issue Dec 21, 2023 · 3 comments
Closed

Unable to link a content across various languages #15498

wtct opened this issue Dec 21, 2023 · 3 comments
Assignees
Labels

Comments

@wtct
Copy link
Contributor

wtct commented Dec 21, 2023

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

v8, v9, v10, v11, v12

Bug summary

Hi everyone,

I have just noticed a strange issue with linking between content pages that are not published in all configured languages.

Let me explain this issue with an example.

Please take into account multilingual site designed for two languages: en and de.

The en language is set as default.
The de language is set as not mandatory.

Site contains several content pages (sections with children).

All sections use the same document type which varies by culture.
All children use another document type which also varies by culture.

Only some pages have been published for both languages.

Site has a main menu with links to that pages. Menu items are configured with URL picker.

All links work as expected for default language.

Unfortunately, when user change language to de by the language switcher, some links are broken in the main menu. Umbraco generates # instead of correct URL for pages which are published only in the default language.

In my opinion, the URL of content in the default en language should be used instead. Otherwise, we are not able to link across different languages without providing content for all of them languages.

The same issue occurs for links placed in the Rich Text editor, so we are not able to link between articles written for specific languages only.

Of course, this issue could be solved by custom UrlProvider, but in my opinion it should be a default or configurable behavior.

Specifics

No response

Steps to reproduce

Steps to reproduce could be found in the bug summary.

Expected result / actual result

When generating a URL for any page which varies by culture, Umbraco should return URL of content published in fallback language, then URL of content published in the default language if the content is not published for current culture.

@wtct wtct added the type/bug label Dec 21, 2023
Copy link

Hi there @wtct!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@Migaroez Migaroez self-assigned this Jan 8, 2024
@Migaroez
Copy link
Contributor

Migaroez commented Jan 8, 2024

Hey, thank you for bringing this unique use-case to our attention.

It seems to me that this is not a bug and the system is working as expected for the following reasons.

  • The Content Picker and Multi Url Picker both save their content targets as a UDI instead of the resolved url to avoid broken urls.
  • When the Content is retrieved for rendering, the fallback value is used and (if you are using value converters) the respective items are fetched from the cache in the fallback culture. (giving you the name in the fallback language)
  • When the .Url() method is then invoked, the variationContextAccesor is retrieved by the IPublishedUrlProvider to fetch the current culture which is passed to all urlProviders.
  • The default urlProviders can't generate a URL in the current culture for the Content because it isn't published yet.
    Thus giving you the described behaviour.

One could add a urlProvider that checks, when a content is not published for a given culture, if there is a fallback culture and run the default urlProvider(s) in that culture instead. But this would go against the idea that unpublished content should not be routed. Yes you are not hitting the actual node, but that in itself can cause confusion for editors.
There is also the argument that you might not want to have this "feature" everywhere in your site and then you need to work around this on a template/controller level instead.

Because of all these permutations, we do not wish to change the behavior of the core at this point.

Feel free to start a discussion to gather feedback from the wider community if you still think this could be a valuable addition to the core. Or it might be a good idea for a package?

Thank you again and a happy new year!

@Migaroez Migaroez closed this as completed Jan 8, 2024
@wtct
Copy link
Contributor Author

wtct commented Jan 18, 2024

Hi @Migaroez,

Happy new year too!

I'm not sure if I understand your argument correctly.

However, I'm satisfied that we are able to implement a CustomUrlProvider with appropriate logic to solve our issue.

You can find more detailed explanation and solution in the "Problem with linking in Umbraco across pages in different cultures" article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants