SOLVED: Tiny MCE creating invalid relative links

Tested on Plone 5.0.5. This is admittedly a somewhat unusual use case, where someone has created a link on the front page in the wysiwyg that points to the root of the site itself. They do this through the external tab, not the internal tab.The issue happens when you are creating a link in the wysiwyg through the external link tab, where the URL happens to be the same website. They don't want to use the internal tab because this page might be accessible through different addresses, but the link should go to only one of those. An example is if we edit the front page of and create a link to itself the resulting code is

<a href="../" data-linktype="external" data-val="">link</a>

Note that the data-val attribute is correct, but the href attribute is treated as a relative link for some reason. And it's not correct, since it will result in

I don't understand why it would try to create a relative location - I don't suppose there is a way to not use that behavior? Barring that, does anyone know if this is a result of tinymce itself, or perhaps the mockup pattern or other Plone integration?

I have the same problem here:

(all internal links 'drops the Plone site')

I've been looking at this more and as far as I can tell there is a config option in TinyMCE for whether links are converted to relative or absolute. If there's a bug there I would assume it's outside the scope of Plone. But the Plone question would be whether the "relative_urls" config should be exposed in the TinyMCE settings of a Plone site. I do not believe it currently is.


in the 'Advanced' tab of the Tinymce control panel, try to add this:

"document_base_url" : ""
AFAICT you can replace this URL by or anything you want; the only URLs you should not use are an empty string (will not work) and the actual URL of your site as it will create some strange result repeating part of the path. For the record I think that Mockup has nothing to do with this behaviour.

I think what I want is actually the below, but great point about the advanced tab:
{"relative_urls": false}

Oddly this doesn't change the link to "", it changes it to "/Plone". At least that works. And I agree this is surely a TinyMCE thing, not a Plone or mockup thing.

I have tried for a whole hour to understand the logic behind all this and failed. Maybe relative means something like '../../'.
If it works for you, so far, so good.