Open sminnee opened 12 years ago
Links in the preview now have the current SubsiteID appended automatically, but that doesn't fix this specific issue - so still relevant.
We're ran into this issue. It's a high priority for us given we link across subsites often.
While this current fix above works, It's not ideal as all links will become absolute.
Perhaps a solution to is to extend the WYSIWYG popup for links, and allow the user to optionally select if they want to link to another subsite in the content?
The following solution allows CMS authors to select links across subsites in a friendly manner:
https://gist.github.com/torleif/1c69c8806ec206bd5b60
Selecting 'another subsite' in the linking options Selecting the page selecting your subsite
Only links that are specified to be a subsite links are made absolute. Instead of relying on the subsites dataobject (which doesn't have the main site and dev domains), you create a list of domains in your _config.php file:
If you want to to create a push for this fix I can.
@torleif are you still seeing this as a problem? If so, are you still willing to submit a pull request to fix it?
@robbieaverill yes we still have this problem. I should be able to create a PR
Hey @torleif, still keen? =D
Reproduced on SilverStripe 4.4.x with Subsites 2.3.x.
For me, the link in the original page to another page on that subsite is empty when you view it through a subsites virtual page on another subsite.
Copied from http://open.silverstripe.org/ticket/6659
When creating a subsite Virtual Page, any links which are inline in the content are broken because they are set to be reletive to the current Subsite rather than the site they are actually on.
To fix it I had to override the core link parser with my own which returns an absolute link taking into account the Subsite the source page is on. It's a little hacky, as I had to set a constant for the main site domain as this is not stored in the db. In Page.php > Page: