Habitat’s code mode lets you view and edit the underlying HTML code for a page. Click the code mode icon to open the panel and access the HTML editor.
Adding or editing HTML code may corrupt the file, rendering it invalid and preventing the project from being published. Before modifying an HTML file, use Habitat’s Duplicate Page functionality to create a backup copy.
Fix Code Mode Errors
Habitat continuously checks the HTML code of every file in a project to ensure it is valid and well-formed. When a file is invalid, Habitat:
- Opens the code mode editor and displays a red X error icon either next to or near each line that contains an error.
- Prevents you from clicking Save and displays the error message:
There are validation errors; please correct them in code view.
You must fix the errors to exit code mode and return to the editing mode.
Hover your cursor over the error icon to view an error message, which helps you understand and resolve the specific error. In the image below, the message indicates that the <header> tag is missing its closing tag, </header>.
If all else fails, remember you can revert your changes to restore your code to its original state.
Errors can cause a cascading error effect, where one erroneous HTML tag or line of code can cause multiple related errors in subsequent lines. In this scenario, it may be difficult to distinguish real errors from related, cascaded errors. If a file has multiple errors, we recommend fixing them by working from the top of the file down to the bottom. Because fixing the primary error also automatically clears related errors, using this top-down method helps reduce the number of issues to fix.