Introducing Template Enhancements
Wouldn't it be great if you could just have Sitemagic CMS automatically load JS and CSS files for you? You can. All you need to do is add the files to the enhancements folder in your website's template folder.
Let's assume you are using the template called Fashion
(find the template you use by logging in
and browse to settings
). That means your JS and CSS files should go into templates/SMFashion/enhancements
. Filenames must end with .js or .css.
SMEventHandler.AddEventHandler(document, "DOMContentLoaded", function()
if (SMDom.HasClass(document.documentElement, "SMPagesFilename" + "Contact") === true)
// Add your code here
Simply replace Contact with the name of your page to make sure the code only runs on the intended page.
Scoping CSS to specific page(s)
Obviously you can make sure styles are only applied to elements with class names chosen by you. But if you want to style more common elements such as input controls or headings, you will need the approach below to make sure styles are only applied on specific pages.
Replace Contact with the name of your page.