I created a page in the app’s CMS page builder, and I want to save it as a HTML template in my theme. I enable developerMode and use the “copy as HubL” feature to copy the content of each section, then I go to Design Manager to place it into an HTML template in my theme. The copied HubL throws error messages in design manager, and I can’t read them because the design manager error log is also broken.
1. Invalid Escape Sequence
The first error I got from the console is “invalid escape sequence.” Why is this the case when the HubL is copied directly from the page? When I copy the HubL from an existing page, can’t I then re-insert that same HubL into an HTML document for use in a HubSpot theme?
I’m copying directly from a published page. The JSON is parsed right there on a page. My expectation is that I can copy the exact same code being used to render a CMS page and duplicate it as a template. I have to believe this is a glitch or broken because I genuinely can’t understand why a certain arrangement of Modules with certain data in their Fields render just fine in one side of CMS, but not on another side.
See screenshot above. Reading the error logs is actually impossible. It’s not possible to scroll down and it’s clearly visible that the messages are colliding. I can’t even read the errors without wrestling to copy and paste the content into a notepad.
Please let me know if there’s something I’m missing or if this is a confirmed bug. If it’s a bug, I’d like to know what’s being done to fix this. Again, I think that a reasonable expectation is that “copy as HubL → paste in HTML file → publish” is the extent of this process.
Your screenshots are coming through very small and it is not possible to see any details. It would be helpful to the community if you could provide higher resolution screenshots.
Confirming that the “Copy as HubL” functionality works fine for me.
Without seeing the full code, just making a guess it could be some conflicts caused by the destination template.
Have you tried using a very plain template like this and dropping in a copied section?
Hi @evaldas, thank you for your reply--I’m going to try that. BTW, unfortunately this post is a duplicate; it was marked as spam so I re-posted this question in this thread:
I created a page in the app’s CMS page builder, and I want to save it as a HTML template in my theme. I enable developerMode and use the “copy as HubL” feature to copy the content of each section, then I go to Design Manager to place it into an HTML template in my theme. The copied HubL throws error messages in design manager, and I can’t read them because the design manager error log is also broken.
1. Invalid Escape Sequence
The first error I got from the console is “invalid escape sequence.” Ok, fair enough, but why is this the case when the HubL is copied directly from the page? Is it not reasonable to assume that when I copy the HubL form a page that is rendering perfectly, I can then re-insert that same HubL into an HTML document for use in a HubSpot theme? As a user, my goal is to be able to copy the HubL and place it into a theme file, then get back to work.
2. Error Parsing JSON
At the risk of sounding repetitive, once again, I’m copying directly from a published page. The JSON is literally parsed right before my eyes. My expectation is that I can copy the exact same code being used to render a CMS page and duplicate it as a template. I have to believe this is a glitch or broken because I genuinely can’t understand why a certain arrangement of Modules with certain data in their Fields render just fine in one side of CMS, but not on another side.
See screenshot above. Reading the error logs is actually impossible. It’s not possible to scroll down and it’s clearly visible that the messages are colliding. I can’t even read the errors without wrestling to copy and paste the content into a notepad.
Please let me know if there’s something I’m missing or if this is a confirmed bug. If it’s a bug, I’d like to know what’s being done to fix this. Again, I think that a reasonable expectation is that “copy as HubL → paste in HTML file → publish” is the extent of this process.
Hey @EGold64,
Thanks for posting in the Community!
I’d like to tag in some Community experts to see what insight they may have on these errors, as well as how to resolve them! @Anton, @EValdes, and @stefen - do you have any thoughts on this inquiry?
Shane, Senior Community Moderator
I’m using a Child Theme of Clean Pro from HS Marketplace
Not for this template, no
The modules in this theme have a lot of options so it’s entirely possible something like that is in there, I will look. But from my end everything is rich text, links to some documents, and a few images.
That actually wasn’t needed in this template so I removed it (but no impact). Thanks for catching that.
In other words: With a Child theme of Clean Pro, I added a bunch of modules to a page, applied some content and style options to them, then hit this road block with the HubL export.
Did not realize this was a duplicate post. Looks like @STierney has consolidated into one now and I see @Anton had asked some good questions already.
It sounds like in your response to Anton’s question regarding custom modules, you are saying that you aren’t utilizing any custom modules (only the standard ones). However, I see in you screenshot a custom module referenced, called “CLEAN Pro - Magic Module”. So that might be something worth doublechecking in your HubL.
Also, I tried copying HubL in a marketplace child theme from multiple sections that contain default modules and try to break the template on purpose to give me similar errors to what you are getting but did not have success there.
If this is one huge single section you are trying to copy over, then I would suggest cloning the page, moving modules from a single section into separate smaller sections, then copying those smaller sections into the template to see which piece of this puzzle might be triggering the error.
Hi @evaldas, thanks for the reply. I didn’t interpret the custom modules question correctly - the modules are the ones that shipped with the theme we are using, so in that context, yes they would be “custom” relative to HubSpot’s default modules. My mistake. I was thinking along the lines of “I have not customized the theme’s modules.”
Where I am at a loss is this Marketplace Theme’s modules work fine on the page in the GUI editor. They are throwing no errors. The errors only come when trying to copy the HubL into a template to use elsewhere. Is it possible this is just an issue with how that marketplace theme was written/created? I’m at a loss and everything being suggested has taken me nowhere, unfortunately.
At this point saving a page as a draft and cloning it is less work than using the template creation process. @hubspot this shouldn’t be this comlplicated!
Thank you for clarifying. In the HubSpot ecosystem, the term “custom module” refers to any module that is not a default HubSpot module (i.e. Rich Text, Image, etc) - so that distinction should help in case you post more questions or your research in the future There are some themes that utilize only default modules but it is common to see custom modules that work only within a specific theme.
In this case, yes it might be possible that these errors are happening because of the way the theme was built. It is not necessarily that the developers did something wrong, often these custom modules can have very advanced settings and may have not been tested in the “copy as HubL” use case. It is a bit of a hidden feature after all.
Since you have a professional licence of the marketplace theme, I would recommend also reaching out to the theme’s support and see if they have any suggestions or comments. Ideally, the creator would either remedy the issue or connect with HubSpot to try and identify any bugs that are affecting capabilities of their theme.