Skip to main content
Support

Add HTML Before the Closing Body Tag

Customizing your docs with JavaScript snippets and CSS is an awesome way to make them stand out. πŸ¦„

Taylor
Updated by Taylor
1 min read

Customizing your docs with JavaScript snippets and CSS is an awesome way to make them stand out.

Most of the time you'll find dropping your custom code into Settings > Customize > Code > CSS or JavaScript works super well by adding code into the <head> portion of your knowledge base. But there might be the odd occasion where you'll wanna add some HTML somewhere else.

For this you'll wanna use the example below replacing Your Code with your custom HTML and saving the entire snippet into Settings > Customize > Code > JavaScript πŸ™ƒ

<script>
var someHTML = 'Your Code'; // string of HTML here
ready(function() {
document.body.insertAdjacentHTML('beforeend', someHTML);
})

function ready(fn) {
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
fn();
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
</script>
Browsers don't run <script> tags added this way.
On a custom HTML template you don't need this snippet: add your code to the end of footer.hbs in Settings > Customize > HTML.

What did you think of this doc?

Previous Making Your Printed HelpDocs Look Nicer Next Using a Background Image in the Header

Get in touch