Landing Pages in Code Mode not working as they did

Your software
My Mautic version is: 4.1
My PHP version is: 7.4
My Database type and version is: 10.3.32-MariaDB-0ubuntu0.20.04.1

Your problem
My problem is: When creating a landing page in “Code Mode”, we drop the HTML file in place as we always have, but the page no longer renders and mautic rewrites the code. We have used leadpages to create the HTML and drop here. Here is the code we are attempting to drop

<html>
  <head>
    <meta property="og:url" content="https://dfir.world/csh-media-kit-thank-you-page/" />
    <link rel="opengraph" href="https://dfir.world/csh-media-kit-thank-you-page/" />
    <script src="//dfir.world/_/js/csh-media-kit-thank-you-page/"></script>
  </head>
</html>

HERE IS WHAT MAUTIC CHANGES IT TO ON SAVE…

<!DOCTYPE html>
<head>
  <meta property="og:url" content="https://dfir.world/csh-media-kit-thank-you-page/">
  <link rel="opengraph" href="https://dfir.world/csh-media-kit-thank-you-page/">
  <style>
  </style>
</head>
<body>
</body>

The JS is being removed. Lead pages has a dynamic builder, meaning I can change the page at leadpages and the changes happen in Mautic. A recent change has caused this to no longer work.

These errors are showing in the log:

Steps I have tried to fix the problem:

Yes, I can confirm that.
Joey

1 Like

I haven’t had a lot of time to look at it. I think the js code is the issue. It will work as expected with “static” code (no js)

Just ran into this same issue today. Using Code Mode, mautic strips anything with a <link tag on it, including bootstrap libraries and external CSS. Frustrating.

Create a template where you preload all the libraries you need.
You can also use the head and footer JS field for populating fields.

Thanks Joey. Turns out it was two things. I couldn’t get scripts/links to load unless I had the integrity check added. Second, any weird spacing in the html (I was using prettier to structure the html file) was getting parsed incorrectly. html should be about ignoring line breaks and spaces, but the html parser in advanced here was treating these as broken tags and removing them on save. An issue with the “cleanup” process on save, I suppose?