The plugin will not output an url for a non-existing page alias. This results in <a href="">...</a> which leads to the homepage (usually). You can check this by looking at the page source.
This is indeed default behavior of the plugin as it is now. The CMSMS dev team recognizes it may be better to output something different and we may implement it in a future version of CMS Made Simple (but not in a minor update).
Assuming you're using the functionality of Microtiny/TinyMCE to add internal links with the wysiwyg editor:
There is not an easy workaround, though, if you know how to read and write a few lines of php code and are using CMSMS 2.x, you can override the default behavior of the plugin.
Move the cms_selflink plugin file to the /assets/plugins folder and make your changes there.
A few important notes:
- we will not support such changes and don't allow 'hacks' to be posted in this forum
- don't forget about this overriding; future upgrades will NOT touch 'your' plugin, so changes in the core plugin will not be working in your site, which will lead to unexpected behavior and/or a broken frontend/backend.
- future upgrades may re-install the plugin on the original location which can lead to a conflict (again risk of breaking frontend/backend)
- clear cache after making changes to your plugin
If you're using the plugin in templates it would be easy to check for the output first and if it's empty generate an url yourself.
Code: Select all
{cms_selflink href='non-existing-alias' assign=foo}
<a href="{$foo|default:"{root_url}/pagenotfound"}">link text</a>