Relative asset urls aren't working as expected

Site url:
http://mysite.com/dev/

cockpit url:
http://mysite.com/dev/cockpit

If I set site_url: “http://mysite.com/dev/” then when I upload and insert an image through the WYSIWYG editor, the image does not show in the WYSIWYG editor, but does show in the source and will show on the front end of the site.

Is there a way to ensure that the image shows in both the WYSIWYG editor and front end?

Hey @jasonday, my answer will not help on the WYWIWYG question but will be more a suggestion on not use that field for handling images. I would use instead the Layout field and build my own cockpit components (Formatted text, Image, Video, etc…) and therefore the page structures are cleaner and can be easily mapped in the frontend to components (e.g. React or Vue components). So when building a page you can insert as you want:

Heading
FormattedText
Image
FormattedText
SubHeading
Image
FormattedText
Video
...

That will result in only one field with a components array so you can implement on your FE the corresponding components using the same name, you can see that in action in https://github.com/pauloamgomes/CockpitCMS-React-Static

Thanks Paulo,

I can appreciate the perspective of requiring more structured content, however I think this remains an issue/bug in Cockpit, as it limits the capabilities and flexibility (in installation, user experience, etc.)

That’s true @jasonday, as said my answer was not on solving the issue.

1 Like