Question

I have a site in ModX Revolution that I am having an issue with. Well... ok, it's not an issue for me, but for my client it will definately be an issue.

The issue is, I am finding that when adding an image to a resource using the CKEditor plugin, the paths to the images are not site relative(they are being put in as assets/images/image.png, when it should be /assets/images/image.png). Which of course will cause them to fail to load in when /page/YXZ is rendered.

I have searched all around, and I cannot find the answer to this seemingly impossible task...

How can I ensure that all files are relative to the site, without having to revert to <base href="" /> tags?

Note:

I cannot use <base href>, due to #identifier links throughout the site.

Was it helpful?

Solution 2

I have "fixed" the issue by going with TinyMCE instead of CKEditor for this. There are special settings in TinyMCE that allow me to set rootrelative links for images and files.

OTHER TIPS

You should be using <base href="[[++site_url]]"> with MODX, or you'll run into all kinds of problems with url references (such as this one).

If you want to use anchor tags, you just need to modify the syntax slightly:

<a href="[[~[[*id]]]]#anchor">My Anchor Link</a>

http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/structuring-your-site/resources/named-anchor

Note for others: if you want to use friendly urls with a MODX site, the <base href=""> tag is essential: http://rtfm.modx.com/revolution/2.x/administering-your-site/using-friendly-urls

Take a look at the 'strip_image_paths' system variable under the file system group... you can set so that modx will rewrite them as either relative or absolute.

You should still be able to use anchor links with the base href.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top