Adding Page Specific JavaScript
If you are looking to add some custom JavaScript to your front pages or Text/HTML modules, you can do this using the JavaScript integration, and then adding the script to the pages in question.
When creating or editing a front site page or a Text/HTML module, you will see the option to Add Script & Styles. This allows you to add page specific CSS (for styling) or page specific JavaScript. When JavaScript, the script tag will not be included on the front page or module settings--instead, you will add this in the JavaScript Integration settings. Then you can add the specific code to the individual page or text module.
- First, add the script tag to the JavaScript area. To do this, go to Integrations from the Admin Dashboard. Then click Manage under the Custom JavaScript option.
- Make sure that Enable Custom JavaScript is turned on.
- Add your script tag to the body tag section:
- Click Save Changes
Now, you can add the specific code to the page or text module.
-
Go to the Text/HTML module, or the front site page you want to add the script to
- For Text/HTML module, click Courses -> Text/HTML and then either select the one you want to edit, or click +Create Text/HTML Module
- For a site page, click Pages & Menus, then Pages. Select the page you want to edit, or click + Create Page
-
Click Add Script & Styles
- Scroll to the JavaScript section, and enter your code with no script tag, similar to this:
- Click Save Changes
- Preview your module or page, and click Save or Update Changes to confirm.