[MULTISITE-109] Incorrect i18n links with subsites Created: 03/Sep/21 Updated: 06/Dec/21 Resolved: 01/Dec/21 |
|
| Status: | Closed |
| Project: | Magnolia Multisite Module |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 2.1.2 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Leah Staniorski | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | maintenance | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | 3h | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Template: |
|
||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||
| Sprint: | Global Maintenance 1, Global Maintenance 2 | ||||||||||||||||||||
| Story Points: | 8 | ||||||||||||||||||||
| Description |
Steps to reproduce (generic - specific below)
Steps to reproduce (Specific for travel demo)
Expected resultsFor the site definition to not be prepending to the url. To see a url like this: https://travel-demo.magnolia-cms.com/de/sub/test-page Actual resultsUrl like: https://travel-demo.magnolia-cms.com/travel0/de/sub/test-page with site definition prepended to url Development notesPartner traced the above behavior to the following code within info.magnolia.multisite.DomainNamePathTransformer: protected String applyI18n(String linkStr, Site targetSite, Link uuidLink, int currentSiteHandlePrefixLen) { final String i18nLinkStr; if (targetSite == null || targetSite.getI18n() == null) { i18nLinkStr = I18nContentSupportFactory.getI18nSupport().toI18NURI(linkStr); } else { i18nLinkStr = targetSite.getI18n().toI18NURI(linkStr); } if (!i18nLinkStr.equals(linkStr) && isSubsite(targetSite, uuidLink.getPath(), uuidLink.getWorkspace(), currentSiteHandlePrefixLen)) { return "/" + targetSite.getName() + i18nLinkStr; } return i18nLinkStr; } /main-site This triggers the above logic, thought to be incorrect because links are not going cross site. WorkaroundA stupid fix is to rename your pages and handle prefixes: **/main-site Now they don't have the same "start" and so Magnolia doesn't match them as "subsites" whatever that means. In practice Partner is finding this is not a good solution, customer has many such situations where a single domain has many small microsites / landing pages / etc. which need their own site definition for custom theming, i18n, etc. and we've already hit enough situations where getting all the naming right is going to be near impossible without constant developer support. Partner is currently deploying a workaround that removes these lines: if (!i18nLinkStr.equals(linkStr) && isSubsite(targetSite, uuidLink.getPath(), uuidLink.getWorkspace(), currentSiteHandlePrefixLen)) { return "/" + targetSite.getName() + i18nLinkStr; } but they don't really know if there will be some negative impact elsewhere.
|