# Landing Pages in Code Mode not working as they did

**URL:** <https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955>\
**Category:** Product Support\
**Tags:** mautic-4\
**Created:** [December 9, 2021, 8:17pm UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955 "2021-12-09T20:17:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevindelong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/kevindelong/32/5018_2.png) [@kevindelong](https://forum.mautic.org/u/kevindelong)\
**Post date:** [December 9, 2021, 8:17pm UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955/1 "2021-12-09T20:17:28Z")

</div>

**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

```auto
<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…

```auto
<!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:

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [December 10, 2021, 11:24am UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955/2 "2021-12-10T11:24:57Z")

</div>

Yes, I can confirm that.  
Joey

---

<div class="post-metadata">

**Author:** ![kevindelong](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/kevindelong/32/5018_2.png) [@kevindelong](https://forum.mautic.org/u/kevindelong)\
**Post date:** [December 10, 2021, 12:35pm UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955/3 "2021-12-10T12:35:00Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![ericc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ericc/32/2958_2.png) [@ericc](https://forum.mautic.org/u/ericc)\
**Post date:** [November 14, 2022, 9:31pm UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955/4 "2022-11-14T21:31:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [November 15, 2022, 8:02am UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955/5 "2022-11-15T08:02:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ericc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ericc/32/2958_2.png) [@ericc](https://forum.mautic.org/u/ericc)\
**Post date:** [November 17, 2022, 6:43pm UTC](https://forum.mautic.org/t/landing-pages-in-code-mode-not-working-as-they-did/21955/6 "2022-11-17T18:43:01Z")

</div>

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?
