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

Subsites + Fluent = incorrect URL segment on edit #416

Open
noizyboy opened this issue May 28, 2019 · 10 comments
Open

Subsites + Fluent = incorrect URL segment on edit #416

noizyboy opened this issue May 28, 2019 · 10 comments

Comments

@noizyboy
Copy link

noizyboy commented May 28, 2019

I initially raised this over on the SilverStripe forums, but haven't had any luck there, so giving it a go here.

Version: Silverstripe CWP 2.1.1 (GitHub - silverstripe/cwp-installer: CWP project template)

When using Fluent in tandem with Subsites, the URLSegment shown on any subsite edit page uses the wrong base domain (making it difficult for the editor to open the page in another tab).

e.g. here’s the page without Fluent installed, showing the correct URL:

de0d0cbc9198fec3b65cebeddc386a1c0b7f81cc

…but if I add Fluent to my build, we get this…

79fa97064e8cff2e45c541e8338368db390b47c9

Any suggestions/ideas as to get the correct URL segment to show in that context?

@robbieaverill
Copy link
Contributor

Assuming "main.localhost" is NOT the configured domain for your "Subsite" subsite, and your screenshots are in the reverse order (the first is with fluent installed and the second is without), then I think there's a bug in fluent + subsites compatibility, probably in the DetectLocaleMiddleware, and we can investigate. Can you confirm my assumptions please?

@noizyboy
Copy link
Author

noizyboy commented May 28, 2019

Ah, yes, sorry - uploaded images in the wrong order. (Fixed).

And yes, it does appear to be directly related to fluent + subsites. Any insights welcome.

@robbieaverill
Copy link
Contributor

Is this affecting the URL segment preview in the CMS only? Or the frontend website as well?

@noizyboy
Copy link
Author

Just the CMS. Front-end is fine.

(Although, having said that, we haven't added any translated content to the site yet, so the translated versions of those pages - and specifically the way the URL segments are generated - are currently an unknown quantity.)

@robbieaverill
Copy link
Contributor

robbieaverill commented May 30, 2019

Reproduced using CWP 2.3.x-dev (SilverStripe 4.4.x-dev with Subsites 2.3.x-dev and Fluent 4.2.x-dev).

Yeah this is a priority issue with Fluent, where both SiteTreeSubsites and FluentSiteTreeExtension are setting $urlSegmentField->setURLPrefix($baseURL) and the $baseURL respectively is either the subsite domain or the fluent domain configuration.

Both subsites and fluent provide the ability to define domains, so I suppose this is overlapping and conflicting functionality, where at the moment Fluent is taking priority.

I think the issue here is with Fluent, not with Subsites. Subsites sets the URL segment field's prefix to be the subsite domain, and when Fluent does the same thing it sets the URL prefix to be the Director::absoluteBaseURL(), which is the current domain you're on. Since subsites doesn't switch to subsite domains when you're editing non-default subsite content, that URL is always the main domain's URL. If Fluent used the exisiting value for the URL segment field prefix instead of defaulting to Director::absoluteBaseURL() then it would respect both the subsite domain and the fluent locale in the URL segment.

Note: if you configure subsite domains AND fluent domains, you'll still have a conflict here. I think the way to fix this right now is to document it clearly, which I'll include in this story.

@robbieaverill
Copy link
Contributor

robbieaverill commented May 30, 2019

Fixed in fluent with tractorcow-farm/silverstripe-fluent#523. I've also made a docs PR at #418.

@noizyboy
Copy link
Author

Thanks Robbie - much appreciated.

@robbieaverill
Copy link
Contributor

No problem, this will be available in the next fluent 4.2.x or newer release. You can pull in 4.2.x-dev for now if you want the fix sooner.

@ScopeyNZ
Copy link
Contributor

Unfortunately the fix in Fluent has been reverted. I'll reopen this until we can solve it (again).

@mohamedallou
Copy link

mohamedallou commented Oct 11, 2019

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

No branches or pull requests

5 participants