-
Notifications
You must be signed in to change notification settings - Fork 115
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
fix: correct preview view when using subsites #1181
Conversation
Preference should be given to the page CMSPreviewLink so to align to the functionality on the main view. Link() should be as a fallback if PreviewLink() is not defined on the page
Can you please create an issue for this, link to the issue, and include more detail in the issue about what the actual problem is and some clearer steps to reproduce it? I've also added the PR template back in, which should have been there when you created the PR initially. Please tick all of the boxes that apply, and make any changes needed (if any) as you go through the list. |
The problem can be seen in the 'Manual steps' above. The CMS Preview when using subsites with Elemental always shows the main website and not the relevant subsite. This is because on the Element, the CMSPreviewLink uses the 'Link' method of the page (which may return mainsite.cwp.govt.nz/page/url) not the correct preview link (mainsite.cwp.govt.nz/page/url?SubsiteID=1) |
Unfortunately I'm not able to follow those steps, which is why I've asked for more details steps I can follow easily. Please also create an issue and link to it - this is important because the CMS Squad tracks issues, not PRs. It will be hard to ensure this gets the attention it deserves if there's no issue we can track. |
Issue at #1182 if that helps at all. |
Based on the description in the linked issue, it seems to me that the API for At the very least, we need to retain the |
I don't think you read the diff correctly - I didn't add the Link() method, I just switched it around so PreviewLink is prefered. The instance of check is still very much present! |
Ahh, yes, apologies I did misread it. |
Looking back at #982 there wasn't any discussion of whether the call to I think I just had it as a fallback because the call to I'll try this PR out with and without subsites just to make sure it works as expected locally, but the code looks okay now that I've refreshed my memory about the logic. |
Actually... I think there might be an underlying concern here that isn't being addressed. Why is |
@GuySartorelli Mentioned in my original post We could change to AbsoluteLink (which uses the subsite domain) and that would 'fix' the issue as well but I imagine the semantics of PreviewLink is correcter :) |
Ohh right, interesting. Sorry, I must have missed that in your initial post. I just gave this a quick test with the intention so merge it, but I can't reproduce the original bug locally even without this PR. Just looking at the code for subsites... there is a The preview URL is still relative, but it adds the subsite ID as a get variable which works fine. Can you please double check the version of subsites you tested against has that extension? |
Description
Preference should be given to the page CMSPreviewLink so to align to the functionality on the main view. Link() should be as a fallback if PreviewLink() is not defined on the parent object.
Manual testing steps
This will manifest itself in a few ways the the easiest way to reproduce is
The calculated preview link would be /page/url which will display the main site 404.
Expected behaviour is it matches the pages PreviewLink (with the relevant
SubsiteID
argument present).Issues
Pull request checklist