Boilerplate

Follow the steps below to create a website on our bespoke CMS.

  1. Create the CSS
  2. Register site with reCAPTCHA v3
  3. Create the JavaScript
  4. Create the includes
  5. Create a general page template
  6. Create a news page template
  7. Create a news home page template
  8. Create a home page template
  9. Create a search results page template
  10. Create a site info page template
  11. Create a contact page template
  12. Create a site info page using a template
  13. Create a general page using a template
  14. Create a news article page using a template
  15. Create a news home page using a template
  16. Create a search results page using a template
  17. Create a home page using a template
  18. Create a contact page using a template
  19. Create a thank you page
  20. Create a site map

1. Create the CSS

1. Navigate to assets > css.

2. Select Create folder, name it the same name of your site (e.g. DGDT) and Publish it.

3. In the folder, select Create text file and insert the following:

4. Copy and paste the CSS below.

4. Please refer to https://www.swqr.org.uk/web-team/boilerplate/index.html#css.

@charset "utf-8";

/* site specific color variables */

:root {--nav-bg-color:#287184;}
:root {--nav-color:#FFFFFF;}
:root {--nav-bg-hover-color:#28828C;}
:root {--nav-hover-color:#FFFFFF;}
:root {--panel-bg-color:#F3F2F1}
:root {--panel-color:#000000}
:root {--table-border-color:#B1B4B6}
:root {--button-color:#FFFFFF}
:root {--button-bg-color:#555658}
:root {--button-bg-hover-color:#747576}
:root {--link-color:#1D70B8}

/* single use colors */
body {background-color:#FFFFFF;color:#000000;}
footer {background-color:#555658;color:#FFFFFF}
footer a {color:#FFFFFF;}
a {color: rgb(0, 0, 238);}

/* IE11 workarounds */
aside, #news, #panel0, #panel1, #panel2, #panel3, summary, main form {background-color: #F3F2F1; color: #000000;}
#navbar, #menu li, #menu li a, ul li:hover ul.subNav, ul li:focus ul.subNav {background-color: #287184; color:#FFFFFF;}
#mobile-main-menu, .chevron {background-color: #287184; color:#FFFFFF; margin-left:0 !important;}
details {border: 2px solid #F3F2F1;}
th, td {border-bottom: 1px solid #B1B4B6;}
main#container a:hover {color:#4C2C92 !important}
input[type=button], input[type=submit] {border:0; font-weight:bold; padding:10px;color: var(--button-color);background-color: var(--button-bg-color);}
input[type=button]:hover, input[type=submit]:hover {background-color: var(--button-bg-hover-color);color: var(--button-color);}
/* end of site specific colors */

.logo {
background-image: url(https://www.dgdrivertraining.org.uk/images/DGDT/DGDTlogo.jpg);
background-repeat: no-repeat;
text-indent: -300%;
height: 48px;
width: 527px;
display: block;
}
aside {background-color: var(--panel-bg-color);}
aside div {padding-right:20px;padding-left:10px;padding-bottom:10px;}
#small-print {float:left;}
#logos {float:right;}
#logos li {display:inline;}
footer {padding:0; clear:both;}

h1 {
font-size: 1.5em;
font-weight: bold;
}
h2 {
font-size: 1.2em;
font-weight: bold;
}
h3 {
font-size: 1.1em;
font-weight: bold;
margin-top: 0;
margin-bottom: 0;
}
h4 {
font-size: 1em;
font-weight: bold;
}
header {
max-width: 1140px;
width: 100%;
margin-left: auto;
margin-right: auto;
margin-bottom:20px;
}
footer {
font-size: 16px;
line-height: 1.5;
max-width: 1110px;
width: 100%;
padding: 15px;
margin:0px;
min-height:180px;
}
a.downloadXls, a.downloadXlsx, a.downloadPps, a.downloadPpt, a.downloadPptx, a.downloadDoc, a.downloadDocx, a.downloadPdf, a.downloadMsAccess {
background: none;
position: relative;
cursor: pointer;
display: inline;
height: 16px;
width: 16px;
margin-bottom: -2px;
margin-left: 4px;
margin-top: 0;
padding-left: 20px;
}
a.downloadPdf {
background: rgba(0, 0, 0, 0) url("https://www2.sqa.org.uk/images/2016/icon8/PDF-16.png") no-repeat scroll 0 0;
}
a.downloadDoc, a.downloadDocx {
background: rgba(0, 0, 0, 0) url("https://www2.sqa.org.uk/images/2016/icon8/MS-Word-16.png") no-repeat scroll 0 0;
}
a.downloadXlsx, a.downloadXls {
background: rgba(0, 0, 0, 0) url("https://www2.sqa.org.uk/images/2016/icon8/MS-Excel-16.png") no-repeat scroll 0 0;
}
#logo {
width: 150px;
height: 85px;
}
.skiplinks {
display:none;
}
main form {
border: 1px solid #999;
background-color: var(--panel-bg-color);
padding: 10px;
}
.error-summary {
border: 5px solid #D4351C;
padding: 10px;
margin-bottom: 25px;
}
fieldset {border:none;}
textarea, select, input[type=text], input[type=email], input[type=password], input[type=date], input[type=number] {padding:10px;}
textarea, select, input[type=text], input[type=email] {width:80%}
label {font-weight: bold;}
input[type='radio'],input[type='checkbox'] {width:18px; height:18px; float:left;}
.required {vertical-align:top; font-size:150%; color:red}
.normal {font-weight:normal;}
body {
font-family: "Helvetica Neue", Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
margin: 0;
text-align: left;
margin: 0 auto;
width:1140px;
}
#grid section {
padding:1px 0 1px 0;
margin-bottom:10px;
background-color: var(--panel-bg-color);
color: var(--panel-color);
}
#grid section div {
padding:0 15px;
}
#grid section ul {padding-left:2px;}
#grid section li {margin-bottom: 10px;}
#grid #news li {list-style: none;}

#grid section a {
background-color: var(--panel-bg-color);
color: var(--link-color);
}
.newsItem p span {
font-size: 16px !important;
}
.menu-item a, .spanMenu {
cursor: pointer;
text-decoration: none;
}
#menu li {
list-style: none;
text-align:left;
background-color: var(--nav-bg-color);
color: var(--nav-color);
margin:0;
padding:15px;
cursor:pointer;
}
ul ul {
margin-top: 20px;
}
li {
margin-bottom: 20px;
}
#navbar {
clear: right;
}
.visuallyhidden {
border: 0;
clip: rect(0, 0, 0, 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: fixed;
width: 1px;
}
.subNav {
display:none;
}
#q {
padding: 8px;
}
input[type=button], input[type=submit] {border:0; font-weight:bold; padding:10px;color: var(--button-color);background-color: var(--button-bg-color);}
input[type=button]:hover, input[type=submit]:hover {background-color: var(--button-bg-hover-color);color: var(--button-color);}
#topleft a, #topright a {
text-decoration: none;
}
#topleft a:hover, #topright a:hover {
text-decoration: underline;
}

/**** media query ****/
@media only screen and (min-width: 1021px) {
ul li ul.subNav.opened {display:block !important;}
#menu {height:50px;}
#menu li {z-index:999;}
#menu > li {height:20px !important;}
#menu > li a {font-size:18px !important;}
section {width:75%; float:left;}
#grid {width:100%; margin:20px 0;}
aside {width:23%; float:right; margin-left:1%; margin-top:20px;margin-bottom:20px;}
#container {
max-width: 1140px;
margin-left: auto;
margin-right: auto;
margin-top:20px;
z-index: 0;
position:relative;
}
.general #container {
max-width: 1140px;
width:50%;
margin-left: auto;
margin-right: auto;
z-index: 0;
position:relative;
}
#searchform {
display: inline;
}
#topleft {
width: 50%;
float: left;
padding: 10px 0;
}
#topright {
width: 50%;
float: right;
padding: 15px 0;
}
#mobile-main-menu {
display: none;
}
#navbar, #top {
clear: both
}
#navbar {
background-color: var(--nav-bg-color);
}
nav {
flex-direction: column;
}
nav ul {
display: flex;
justify-content:space-around;
padding: 0;
font-size: 18px;
margin:0;
}
.spanMenu {
width:100%;
}
.showSubNav {
z-index: 1;
}
.showSubNav li {
font-size: 16px;
text-align: left;
}
ul li ul.subNav {
display: none;
}
.menu-item {
padding:10px;
}
#menu li:hover, #menu li:hover a {
background-color: var(--nav-bg-hover-color);
height:100%;
}
#menu li a, #menu li:hover .subNav a {
color:var(--nav-color);
background-color:var(--nav-bg-color);
text-decoration: none;
}
#menu li:hover .subNav a:hover, #menu li:hover .subNav li:hover a {
background-color:var(--nav-bg-hover-color) !important;
text-decoration:underline;
}
#menu li span a:hover {
color:var(--nav-hover-color) !important;
background-color:var(--nav-bg-hover-color) !important;
text-decoration: underline;
}
#menu .current {
background-color: var(--nav-bg-hover-color) !important;
color: var(--nav-hover-color) !important;
margin:0;
}
#menu .subNav li:hover {
height: 100%;
}

ul li:hover ul.subNav, ul li:focus ul.subNav {
display: block;
background-color: var(--nav-bg-color);
z-index: 1;
position:absolute;
padding-right: 10px;
}
.notcurrent {
padding: 8px;
}
#grid {
display: flex;
flex-wrap: wrap;
}
#grid h1 {
margin-top: 10px;
}
#news, #panel0, #panel1, #panel2 {
flex: 1;
border-right: 15px solid #FFFFFF;
}
#panel3 {
flex: 1;
}
details {
border: 2px solid var(--panel-bg-color);
border-radius: 2px;
margin-bottom:10px;
}
details > p, details > li, details > div {
padding: 10px;
}
details > li {
margin-left: 10px;
}
summary {
padding: 10px;
background-color: var(--panel-bg-color);
cursor:pointer;
}
th, td {
border-bottom: 1px solid var(--table-border-color);
padding: 10px 20px 10px 0;
text-align: left;
vertical-align: top;
}
table {
width: 100%;
}
}

/**** media query ****/
@media only screen and (max-width: 1020px) {

main,section, aside {width:100%; float:none;}
#searchform {width:100%;margin:20px 0;}
#q {width:74%;}

#mobile-main-menu {
background-color: var(--nav-bg-color);
color: var(--nav-color);
padding: 2px 0;
display: block;
height: 50px;
position: relative;
text-align: center;
width: 100%;
font-size:18px;
}
#mobile-main-menu i {
float: right;
padding: 8px;
}
#mobile-main-menu span {
line-height: 3;
}
#menu {
display: block;
font-size: 1.3em;
padding: 0;
margin: 0;
}
#bars {
float: right;
margin: 5px;
}
.chevron::before {
border-style: solid;
border-width: 0.25em 0.25em 0 0;
content: '';
display: inline-block;
height: 0.45em;
left: 0.15em;
position: relative;
top: 0.25em;
vertical-align: top;
width: 0.45em;
transform: rotate(135deg);
float:right;
transition: 0.2s;
}
.opened.chevron::before {
top: 0.15em;
transform: rotate(-45deg);
transition: 0.2s;
}
#menu .current {
background-color: var(--nav-bg-color) !important;
}
.navHide {
opacity:0;
max-height:0;
transition:opacity .1s linear;
display: none;
}
.navShow {
opacity:1;
max-height:100%;
transition: opacity .5s linear;
display: block;
}
.bar1, .bar2, .bar3 {
width: 35px;
height: 5px;
background-color:#FFFFFF;
margin: 6px 0;
transition: 0.4s;
}
.close .bar1 {
transform: rotate(-45deg) translate(-9px, 6px);
}
.close .bar2 {
opacity: 0;
}
.close .bar3 {
transform: rotate(45deg) translate(-8px, -8px);
}
#grid {
flex-wrap: wrap;
padding-bottom: 5px;
}
#grid img, #hero, #container picture {display:none;}
}

/**** media query ****/
@media only screen and (min-width: 769px) and (max-width: 1020px) {
body {
width: 96% !important;
margin-top: 20px;
}
main,section, aside {width:100%; float:none;}
#grid {width:100%;margin:20px 0;}

#searchform {
float: right !important;
margin-top: 15px !important;
margin-bottom: 15px !important;
}
#menu li a {
margin-left: 0px;
}
.subNav li {
margin-left:-20px;
}
footer {
min-height: 250px;
}
#nav, #top, #container, footer {
margin: 0 auto;
width: 100%;
}
#container {
max-width: 760px;
width: 100%;
padding: 15px 0 15px 20px;
margin-left: auto;
margin-right: auto;
}
.chevron {
padding-left:10px;
background-color: var(--nav-bg-color);
color: var(--nav-color);
}
#menu .subNav li {
padding-left:40px;
}
.showSubNav {
display:block;
padding-left:0;
margin-left:0;
}
#grid img, #hero, #container picture {display:none;}
}

/**** media query ****/
@media only screen and (min-width: 577px) and (max-width: 768px) {
body {
width: 95% !important;
margin-top: 20px;
}
main,section, aside {width:100%; float:none;}
aside {padding-top:10px;}
#grid {width:100%;margin:20px 0;}

#searchform {
float: right !important;
margin-top: 15px !important;
margin-bottom: 15px !important;
}
#menu li a {
margin-left: 0px;
}
.subNav li {
padding-left:0;
margin-left:-20px;
}
#nav, #top, #container, footer {
margin: 0 auto;
width: 95%;
}
footer {
min-height: 250px;
}
#container {
/*padding: 15px;*/
margin-left: auto;
margin-right: auto;
}
.showSubNav {
display:block;
}
#grid img, #hero, #container picture {display:none;}
}

/**** media query ****/
@media only screen and (max-width: 576px) {

.logo {
background-image: url(https://www.dgsafetyadvisers.org.uk/images/DGDT/small-DGDTlogo.jpg);
background-repeat: no-repeat;
text-indent: -300%;
height: 30px;
width: 333px;
display: block;
}
body {
width: 92% !important;
margin:0 auto;
}
header {margin-top:20px;}
aside {padding-top:10px;}

#searchform {
margin-top: 15px !important;
margin-bottom: 20px !important;
}
#q {width:260px; padding:8px 2px;}

#menu li a {
margin-left: -10px;
}
#menu li:hover {background-color: var(--nav-bg-color)!important;}
#menu li .subNav li a {
margin-left:-20px !important;
}
#nav, #top, #container {
margin: 0 auto;
width: 100%;
}
footer {
width:92%;
min-height:350px;
margin:20px 0;
}
footer ul {padding:0;}
#container {
margin-left: auto;
margin-right: auto;
}
#menu li.menu-item.chevron {
padding:12px;
}
.menu-item a, .spanMenu {
padding:12px;
text-decoration:none;
}
#grid section {
padding: 10px 0;
margin:20px 0;
}
.showSubNav {
display:block;
}
#grid img, #hero, #container picture {display:none;}
}

/**** media query ****/
@media (prefers-color-scheme: dark) {}

/**** media query ****/
@media (prefers-color-scheme: light) {}

5. Change the parts in yellow to refelct your site.

6. Save the text file and Publish it.

You should have something like this:

CSS

2. Register site with reCAPTCHA v3

1. Log in to Google reCAPTCHA.

2. Select Add button and register your site.

Register a new site

3. Select Submit.

4. You will now see both your site key and secret key. Take a note of the secret key as you will need this for the next part.


3. Create the JavaScript

1. Navigate to assets > js.

2. Select Create folder, name it the same name of your site (e.g. DGDT) and Publish it.

3. In the folder, select Create text file and insert the following:

  • Name: main.js
  • Mime Primary Type: text
  • Mime Sub-type: javascript
  • Syntax: JS

4. Copy and paste the JavaScript below.

document.getElementById("mobile-main-menu").addEventListener("click", function(e){
let mmm = document.getElementById("mobile-main-menu");
mmm.classList.toggle("close");
let mobileMenu = document.getElementById('nav');
mobileMenu.classList.toggle("navHide");
mobileMenu.classList.toggle("navShow");
});

var topMenus = document.querySelectorAll('.menu-item > a');
for (var i = 0; i < topMenus.length; i++) {
topMenus[i].addEventListener('focus', function(event) {
var subNavs = document.querySelectorAll('.showSubNav');
for (var j = 0; j < subNavs.length; j++) {
subNavs[j].classList.remove('showSubNav')
}
var opened = document.querySelectorAll('.opened');
for (j = 0; j < opened.length; j++) {
opened[j].classList.remove('opened')
}
var openMenus=document.querySelectorAll('[aria-expanded="true"]');
for (j = 0; j < openMenus.length; j++) {
openMenus[j].setAttribute("aria-expanded", false);
}
});
}

var subMenus = document.querySelectorAll('a.chevron');
for (var i = 0; i < subMenus.length; i++) {
subMenus[i].addEventListener('click', function(event) {
event.target.classList.toggle("opened");
event.target.setAttribute("aria-expanded", true);
var targetElement = event.target.nextElementSibling;
var subMenu=targetElement.children[0];
targetElement.classList.toggle("opened");
targetElement.classList.toggle("showSubNav");
targetElement.focus();
});
}
window.addEventListener("keydown", function(event) {
var keyPressed = event.which;
if (keyPressed == 13 || keyPressed == 32 || keyPressed == 40) {
var focused = document.activeElement;
if (focused.getAttribute('aria-haspopup')) {
focused.setAttribute("aria-expanded", true);
var targetElement = focused.nextElementSibling;
var subMenu=targetElement.children[0].children[0];
targetElement.classList.toggle("opened");
targetElement.classList.toggle("showSubNav");
subMenu.focus();
}
}
});

5. Save the text file and Publish it.

Main JavaScript

6. In the folder, select Create text file and insert the following:

  • Name: cookie-control-v9.js
  • Mime Primary Type: text
  • Mime Sub-type: javascript
  • Syntax: JS

7. Copy and paste the JavaScript below.

var cc_config = {
position: "LEFT",
apiKey: '0000000000000000000000000000000000000000',
product: 'PRO_MULTISITE',
initialState: "NOTIFY",
necessaryCookies: ['JSESSIONID', 'HASQA'],
optionalCookies: [
{
name : 'analytics',
label: 'Analytical Performance Cookies',
description: 'Counts the number of visitors and how visitors move around the website (does not collect personal information).',
cookies: [
// Google Analytics
'_utma', '_utmb', '_utmc', '_utmt', '_utmz', '_ga', '_gat', '_gid'
],
initialConsentState: "on",
onAccept : function(){

localStorage.removeItem("analyticsRevoked");

// Google Tag Manager
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-0000000');
// End Google Tag Manager

},
onRevoke: function(){
// Disable Google Analytics
window['ga-disable-UA-00000000-1'] = true;
// End Google Analytics

// Remember on Revoke
localStorage.setItem("analyticsRevoked", "true");
}
}
],

text : {
notifyTitle: 'We use cookies to give you the best possible experience...',
notifyDescription: 'If you don\'t want to accept cookies you can change preferences',
title: 'This site uses cookies.',
intro: 'Some of these cookies are essential, while others help us to improve your experience by providing insights into how the site is being used.',
necessaryTitle : 'Necessary Cookies',
necessaryDescription : 'Required for the operation of the website.',
thirdPartyTitle : 'Warning: Some cookies require your attention',
thirdPartyDescription : 'Consent for the following cookies could not be automatically revoked. Please follow the link(s) below to opt out manually.',
acceptRecommended: 'Accept'
},
statement : {
description: 'For more information visit our',
name : 'Cookies Statement',
url: 'https://www.sqa.org.uk/sqa/1432.html',
updated : '24/05/2019'
},
branding : {
alertBackground: "#28828C",
fontColor: "#FFFFFF",
backgroundColor: "#3E3E3F",
toggleText: "#000000",
toggleColor: "#28828C",
toggleBackground: "#FFFFFF",
buttonIcon: null,
buttonIconWidth: "64px",
buttonIconHeight: "64px",
removeIcon: false,
removeAbout: false,
acceptBackground: "#FFFFFF",
acceptText: "#000000",
rejectBackground: "#000000",
rejectText: "#FFFFFF"
},
accessibility : {
outline: true
}
};

CookieControl.load( cc_config );

Change the parts in yellow to refelct the style of your site. Follow the instructions in section 21. Implement Google Tag Manager to update the section highlighted in teal.

8. Save the text file and Publish it.

JavaScript

9. Navigate to assets > scripts.

10. Select Create folder, name it the same name of your site (e.g. DGDT) and Publish it.

11. In the folder, select Create text file and insert the following:

  • Name: contact.js
  • Mime Primary Type: text
  • Mime Sub-type: javascript
  • Syntax: JS

12. Copy and paste the JavaScript below.

var ccc = Packages.ccc;
var resources = services.getResources();

// Form fields
var name = request.getParameter("name");
var email = request.getParameter("email");
var enquiry = request.getParameter("enquiry");
var comments = request.getParameter("comments");

// Validation
var errors = new java.util.ArrayList();
if (name==null || 0==name.trim().length()) {
errors.add("<a href='#name'>Please enter your name</a>\n");
}
if (email==null || 0==email.trim().length()) {
errors.add("<a href='#email'>Please enter your e-mail address</a>\n");
} else if (!ccc.api.types.EmailAddress.isValidText(email)) {
errors.add("<a href='#email'>Please enter your e-mail address</a>\n");
}
if (enquiry==null || 0==enquiry.trim().length()) {
errors.add("<a href='#enquiry'>Please select your enquiry</a>\n");
}
if (comments==null || 0==comments.trim().length()) {
errors.add("<a href='#comments'>Please enter your comments</a>\n");
}

// reCAPTCHA v3
var secret = "0000000000000000000000000000000000000000";
var userResponse = request.getParameter("g-recaptcha-response");
var remoteip = request.getHeader("X-Forwarded-For");
if (remoteip == null || remoteip.length() == 0 || "unknown".equalsIgnoreCase(remoteip)) {
remoteip = request.getHeader("X-Civic-Real-IP");
}
if (remoteip == null || remoteip.length() == 0 || "unknown".equalsIgnoreCase(remoteip)) {
remoteip = request.getRemoteAddr();
}
var body = "secret=" + secret + "&remoteip=" + remoteip + "&response=" + userResponse;
var mt = new Packages.ccc.api.types.MimeType("application", "x-www-form-urlencoded")
var resp = Packages.ccc.commons.HTTP.post("https://www.google.com/recaptcha/api/siteverify", body, mt, 10000);
var captchaResponse = new org.json.JSONObject(resp);
if (!captchaResponse.getBoolean("success")) {
errors.add("We're having problems with reCAPTCHA - " + captchaResponse.getString("error-codes"));
} else {
var score = parseFloat(captchaResponse.getString("score"));
if (captchaResponse.getString("action") == "validate_captcha" && score > 0.3) {
// errors.add("You are a human");
} else {
errors.add('There is a problem submitting your form. Please contact <a href="mailto:adr@sqa.org.uk">DGDT</a> quoting reference v3'+score);
}
}
// End reCAPTCHA v3

if (0==errors.size())
{
var fromAddress = new ccc.api.types.EmailAddress("no-reply@apps.sqa.org.uk");
var toAddress = new ccc.api.types.EmailAddress("adr@sqa.org.uk");

var subject = "Contact us";
var message = "Name: "+name+" \n"
+ "Email: "+email+" \n"
+ "Enquiry: "+enquiry+" \n"m
+ "Comments: "+comments+" \n";

mail.send(toAddress, fromAddress, subject, message);
response.sendRedirect("https://www.dgdrivertraining.org.uk/DGDT/Thank-you?success=ok");
}
else
{
response.reset();
request.setAttribute("Contact.errors", errors);
request.setAttribute("name", name);
request.setAttribute("email", email);
request.setAttribute("enquiry", enquiry);
request.setAttribute("comments", comments);
request.getRequestDispatcher("/DGDT/Contact").forward(request, response);
}

Change the parts in yellow to refelct the style of your site. Refer to Google reCAPTCHA and update the section highlighted in teal with your secret key.

13. Save the text file and Publish it.

Contact JS

4. Create the includes

In this example, the html header, the header and footer sections are consistent across all pages so these are candidates for includes, but in other cases, you may want to create a left or right include depending on the design of the site.

1. Navigate to assets > includes.

2. Select Create folder, name it the same name of your site (e.g. DGDT) and Publish it.

3. In the folder, select Create text file and include the following:

  • File Name: inc_header
  • Mime Primary Type: text
  • Mime Sub-type: html
  • Syntax: HTML

4. Copy and paste the HTML below.

4. Please refer to https://www.swqr.org.uk/web-team/boilerplate/index.html#includes.

<!-- Google Tag Manager (noscript) -->
<noscript><iframe title="Google Tag Manager" src="https://www.googletagmanager.com/ns.html?id=GTM-0000000" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<ul class="skiplinks">
<li><a href="#container">Skip to content</a></li>
<li><a href="#nav">Skip to main navigation</a></li>
<li><a href="/DGDT/accessibility">Skip to accessibility page</a></li>
</ul>
<header>
<div id="top">
<span id="topleft">
<a href="/DGDT/Home">
<span class="logo">Logo title</span>
</a>
</span>
<div id="topright">
<form id="searchform" style="float:right;" action="/DGDT/Search-results" method="get" enctype="multipart/form-data">
<label for="q"><span class="visuallyhidden">Search</span><input id="q" name="q" size="30" placeholder="Enter search term" /></label>
<input type="submit" id="submit" value="Search" title="Search" />
</form>
</div>
</div>
<div id="navbar">
<div id="mobile-main-menu">
<span>Main Menu</span>
<div id="bars">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</div>
</div>
<nav id="nav" class="navHide">
<ul id="menu">
##set ($startLevel = 1)
##set ($endLevel = 1)
##menuTag()
## Get base level menu items
#set ($menuPages = $resources.list($resources.resourceForPathSecure("/DGDT/").getId(), null, null, null, "true", null, null, "true", "manual", $enums.of("ccc.api.types.SortOrder", "ASC"), 1, 100).getElements())
## Iterate through them, and if some are folders, search for menu items under them
#foreach ($menuPageRS in $menuPages)
#if ($menuPageRS.getId().equals($resource.getId()) || $menuPageRS.getId().equals($resource.getParent()))
#set ($extraClass = "current")
#else
#set ($extraClass = "")
#end
## We found a folder, so retrieve all menu items under it for the drop down menu.
#if ($menuPageRS.getType().toString().equals("FOLDER"))
#set ($thisMenuPages = $resources.list($menuPageRS.getId(), null, null, null, "true", null, null, "true", "manual", $enums.of("ccc.api.types.SortOrder", "ASC"), 1, 100).getElements())
#if ($thisMenuPages.size() > 0)
#foreach ($thisMenuPageRS in $thisMenuPages)
#if ($resource.getParent().equals($thisMenuPageRS.getId()))
#set ($parentExtra = "open")
#break
#else
#set ($parentExtra = "")
#end
#end
<li class="menu-item $!extraClass $!parentExtra">
<a href="javascript:void(0);" class="chevron" aria-haspopup="true" aria-expanded="false">$menuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")</a>
<ul class="subNav">
#foreach ($thisMenuPageRS in $thisMenuPages)
#if ($resource.getParent().equals($thisMenuPageRS.getId()))
<li class="current">
$thisMenuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")
</li>
#else
<li class="notcurrent">
<a href="$thisMenuPageRS.getAbsolutePath()">$thisMenuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")</a>
</li>
#end
#end
</ul>
</li>
#else
#if ($resource.getParent().equals($menuPageRS.getId()))
<li class="$!extraClass">
$menuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")
</li>
#else
<li class="$!extraClass">
<a href="$menuPageRS.getAbsolutePath()">$menuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")</a>
</li>
#end
#end
#else
#if ($menuPageRS.getId().equals($resource.getId()) || $menuPageRS.getId().equals($resource.getParent()))
<li class="menu-item $!extraClass">
<span class="spanMenu">$menuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")</span>
</li>
#else
<li class="menu-item $!extraClass">
<span class="spanMenu"><a href="$menuPageRS.getAbsolutePath()">$menuPageRS.getName().replaceAll("_"," ").replaceAll("-"," ")</a></span>
</li>
#end
#end
#end
</ul>
</nav>
</div>
</header>

5. Change the parts in yellow to reflect your site. Change GTM-0000000 to reflect your Container ID. Follow the instructions in section 21. Implement Google Tag Manager.

6. Save the text file and Publish it.

7. Select Create text file in the same folder and include the following:

  • File Name: inc_html_head
  • Mime Primary Type: text
  • Mime Sub-type: html
  • Syntax: HTML

8. Copy and paste the HTML below.

<head>
<meta charset="utf-8">
<title>$resource.getTitle()</title>
<meta name="title" content="$resource.getTitle()">
<meta name="description" content="$resource.getDescription()">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/images/favicon.ico" />
<link rel="stylesheet" href="/assets/css/DGDT/style.css" type="text/css">
</head>

9. Change the part in yellow to reflect your site.

10. Save the text file and Publish it.

11. Select Create text file in the same folder and include the following:

  • File Name: inc_footer
  • Mime Primary Type: text
  • Mime Sub-type: html
  • Syntax: HTML

12. Copy and paste the HTML below.

<footer>
<div id="small-print">
<p><a href="/DGDT/accessibility">Accessibility</a></p>
<p><a href="/DGDT/site-map">Site map</a></p>
<p><a href="/DGDT/terms-and-conditions">Terms and conditions</a></p>
<p>&copy; 2020 Scottish Qualifications Authority</p>
</div>
<div id="logos">
<ul>
<li><a href="https://www.gov.uk/government/organisations/department-for-transport"><img width="130" height="79" src="/images/DGSA/DFTlogo.png" alt="Department for Transport logo" /></a></li>
<li><a href="https://www.gov.uk/government/organisations/driver-and-vehicle-standards-agency"><img width="130" height="79" src="/images/DGSA/DVSAlogo.png" alt="Driver and Vehicle Standards Agency logo" /></a></li>
<li><a href="https://www.sqa.org.uk"><img alt="Scottish Qualifications Authority logo" width="115" height="79" src="/images/DGSA/SQA-logo.png"></a></li>
</ul>
</div>
</footer>
<script defer src="https://cc.cdn.civiccomputing.com/9/cookieControl-9.x.min.js"></script>
<script defer src="/assets/js/DGDT/cookie-control-v9.js"></script>
<script defer src="/assets/js/DGDT/main.js"></script>

13. Change the parts in yellow to refelct your site.

14. Save the text file and Publish it.

You should have something like this:

Footer Include

5. Create a general page template

1. Navigate to assets > templates.

2. Select Create a folder with the name of your site (e.g. DGDT).

3. In the folder you created, select Create template for the general page and insert the following:

  • Name: e.g. DGDT-general
  • Mime Primary Type: text
  • Mime Sub-type: html

4. Click Next.

5. In the Definition XML window, replace <fields></fields> with:

<fields>
<field name="header" type="text_field" title="Header" description="Header"/>
<field name="subjectImage" type="image" title="Subject Image" description="Subject Image"/>
<field name="altTextSubjectImage" type="text_field" title="Alt Text Subject Image" description="Alt Text Subject Image"/>
<field name="content" type="html" title="Content" description="Content"/>
</fields>

There are 3 types of fields you can feature in your XML:

  • text_field: a basic text editor enabling you to add text.
  • image: an image selector enabling you to select an image from the CMS.
  • html: a rich text editor enabling you to add hyperlinks and style text.

You can have as many fields as you want, just be sure to name them appropriately. See how they match up when you are creating a page using a template.

If a field name defined in your XML does not match with HTML below, you will not see your content for that particular field.

6. Click Next.

7. In the Body window, copy and paste the following:

7. Please refer to https://www.swqr.org.uk/web-team/boilerplate/index.html#general.

#set($uniqueId = $resources.resourceForPathSecure("/DGDT/site-info").getId())
#set($related = $pages.retrieve($uniqueId).getParagraph("related").getText())
<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")
<body id="DGDT">
#parse ("/assets/includes/DGDT/inc_header")
<main id="container">
<section>
<h1>$resource.getParagraph("header").getText()</h1>
#if($resource.getParagraph("altTextSubjectImage") && $resource.getParagraph("altTextSubjectImage").getText().length() > 0)
<img loading="lazy" id="hero" alt="$!resource.getParagraph('altTextSubjectImage').getText()" src="#optionalImage('subjectImage')" width="860" height="240"/>
#end
$!resource.getParagraph("content").getText()
</section>
<aside>
$related
</aside>
</main>
#parse ("/assets/includes/DGDT/inc_footer")
</body>
</html>

8. Change the parts in yellow to point to the includes files you created.

9. Save the template and Publish it.


6. Create a news page template

1. Navigate to assets > templates.

2. In the folder where you created the general page template, create a template for the news page and insert the following:

  • Name: e.g. DGDT-news
  • Mime Primary Type: text
  • Mime Sub-type: html

3. Click Next.

4. In the Definition XML window, replace <fields></fields> with:

<fields>
<field name="header" type="text_field" title="Header" description="Header for the main section." />
<field name="summary" type="html" title="Summary" description="Summary for the main section." />
<field name="content" type="html" title="Content" description="Content of the main section." />
</fields>

5. Click Next.

6. In the Body window, copy and paste the following:

#set($uniqueId = $resources.resourceForPathSecure("/DGDT/site-info").getId())
#set($related = $pages.retrieve($uniqueId).getParagraph("related").getText())
<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")
<body id="DGDT">
#parse ("/assets/includes/DGDT/inc_header")
<main id="container">
<section>
<article id="main_short">
<h1>$resource.getParagraph("header").getText()</h1>
$resource.getParagraph("content").getText()
</article>
</section>
<aside>
$related
</aside>
</main>
#include ("/assets/includes/DGDT/inc_footer")
</body>
</html>

See how we don't feature the summary field in the HTML? That's because we feature that on the news home and home pages.

7. Change the parts in yellow to point to the includes files you created.

8. Save the template and Publish it.


7. Create a news home page template

1. Navigate to assets > templates.

2. In the folder where you created the general page template, create a template for the news home page and insert the following:

  • Name: e.g. DGDT-news-home
  • Mime Primary Type: text
  • Mime Sub-type: html

3. Click Next.

4. In the Definition XML window, replace <fields></fields> with:

<fields></fields>

5. Click Next.

6. In the Body window, copy and paste the following:

6. Please refer to https://www.swqr.org.uk/web-team/boilerplate/index.html#news-home.

#set($uniqueId = $resources.resourceForPathSecure("/DGDT/site-info").getId())
#set($related = $pages.retrieve($uniqueId).getParagraph("related").getText())
<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")
<body>
#parse ("/assets/includes/DGDT/inc_header")
<main id="container">
<section>
<h1>News</h1>
#set($criteria = $apiTypes.createResourceCriteria())
#set($folderResource=$resources.resourceForPathSecure("/DGDT/News"))
#set($folderResourceId=$folderResource.getId())
$criteria.setParent($folderResourceId)
$criteria.setPublished(true)
## Only published resources
$criteria.setType($enums.of("ccc.api.types.ResourceType","PAGE"))
## Only pages
$criteria.setSortField("dateCreated")
## Order by creation date, most recent first
$criteria.setSortOrder($enums.of("ccc.api.types.SortOrder", "DESC"))
#set($results = $resources.list($criteria,1,50).getElements())
#foreach($result in $results)
#if (!$result.getId().equals($folderResource.getIndexPage()))
#set($resultPage=$pages.retrieve($result.getId()))
<div class="newsItem">
<h2><a href="$result.getAbsolutePath()">$result.getTitle()</a></h2>
<div>$resultPage.getParagraph("summary").getText()</div>
</div>
#end
#end
</section>
<aside>$related</aside>
</main>
#include ("/assets/includes/DGDT/inc_footer")
</body>
</html>

7. Change the parts in yellow to point to the includes files you created.

8. Save the template and Publish it.


8. Create a home page template

1. Navigate to assets > templates.

2. In the folder you created for the general page template, create another template for the home page and insert the following:

  • Name: e.g. DGDT-home
  • Mime Primary Type: text
  • Mime Sub-type: html

3. Click Next.

4. In the Definition XML window, replace <fields></fields> with:

<fields>
<field name="heroImage" type="image" title="Hero Image" description="Width 1140px)"/>
<field name="heroImageSmall" type="image" title="Small Hero Image" description="width 382px"/>
<field name="heroImageAlt" type="text_field" title="Hero Image Alt" description="Hero Image Alt"/>
<field name="Description" type="html" title="Description" description="Description"/>
<field name="panel0Image" type="image" title="Panel 0 Image" description="Panel 0 Image"/>
<field name="panel0ImageAlt" type="text_field" title="Panel 0 Alt text" description="Panel 0 Alt text"/>
<field name="panel0" type="html" title="No news panel" description="Panel 0"/>
<field name="panel1Image" type="image" title="Panel 1 Image" description="Panel 1 Image"/>
<field name="panel1ImageAlt" type="text_field" title="Panel 1 Alt text" description="Panel 1 Alt text"/>
<field name="panel1" type="html" title="Panel 1" description="Panel 1"/>
<field name="panel2Image" type="image" title="Panel 2 Image" description="Panel 2 Image"/>
<field name="panel2ImageAlt" type="text_field" title="Panel 2 Alt text" description="Panel 2 Alt text"/>
<field name="panel2" type="html" title="Panel 2" description="Panel 2"/>
<field name="panel3Image" type="image" title="Panel 3 Image" description="Panel 3 Image"/>
<field name="panel3ImageAlt" type="text_field" title="Panel 3 Alt text" description="Panel 3 Alt text"/>
<field name="panel3" type="html" title="Panel 3" description="Panel 3"/>
</fields>

Remember, if a field name defined in your XML does not match with HTML below, you will not see your content for that particular field.

5. Click Next.

6. In the Body window, copy and paste the following:

6. Please refer to https://www.swqr.org.uk/web-team/boilerplate/index.html#home.

<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")
<body id="DGDT">
#parse ("/assets/includes/DGDT/inc_header")
<main id="container">
<h1 class="visuallyhidden">Home page</h1>
<img id="hero" alt="$!resource.getParagraph('heroImageAlt').getText()" width="1140" height="300" src="#optionalImage('heroImage')">
$!resource.getParagraph("Description").getText()
<section id="grid">
#set($panel0=$!resource.getParagraph("panel0").getText())
#if($panel0 && !$panel0.isEmpty())
<section id="panel0">
#if($resource.getParagraph("panel0Image") && $resource.getParagraph("panel0Image").getText().length() > 0)
<img loading="lazy" alt="$!resource.getParagraph('panel0ImageAlt').getText()" src="#optionalImage('panel0Image')" />
#end
<div>$!resource.getParagraph("panel0").getText()</div>
</section>
#else
<section id="news">
<div>
<h2>News</h2>
#set($criteria = $apiTypes.createResourceCriteria())
#set($folderResource=$resources.resourceForPathSecure("/DGDT/News"))
#set($folderResourceId=$folderResource.getId())
$criteria.setParent($folderResourceId)
$criteria.setPublished(true) ## Only published resources
$criteria.setType($enums.of("ccc.api.types.ResourceType","PAGE")) ## Only pages
$criteria.setSortField("dateCreated") ## Order by creation date, most recent first
$criteria.setSortOrder($enums.of("ccc.api.types.SortOrder", "DESC"))

#set($results = $resources.list($criteria,1,3).getElements())
<ul>
#foreach($result in $results)
#if (!$result.getId().equals($folderResource.getIndexPage()))
#set($resultPage=$pages.retrieve($result.getId()))
<li class="newsItem">
<a href="$result.getAbsolutePath()">$result.getTitle()</a>
</li>
#end
#end
</ul>
<p><a href="/DGDT/News">View all news</a></p>
</div>
</section>
#end
<section id="panel1">
#if($resource.getParagraph("panel1Image") && $resource.getParagraph("panel1Image").getText().length() > 0)
<img loading="lazy" width="274" height="140" alt="$!resource.getParagraph('panel1ImageAlt').getText()" src="#optionalImage('panel1Image')" />
#end
<div>$!resource.getParagraph("panel1").getText()</div>
</section>
<section id="panel2">
#if($resource.getParagraph("panel2Image") && $resource.getParagraph("panel2Image").getText().length() > 0)
<img loading="lazy" width="274" height="140" alt="$!resource.getParagraph('panel2ImageAlt').getText()" src="#optionalImage('panel2Image')" />
#end
<div>$!resource.getParagraph("panel2").getText()</div>
</section>
<section id="panel3">
#if($resource.getParagraph("panel3Image") && $resource.getParagraph("panel3Image").getText().length() > 0)
<img loading="lazy" width="274" height="140" alt="$!resource.getParagraph('panel3ImageAlt').getText()" src="#optionalImage('panel3Image')" />
#end
<div>$!resource.getParagraph("panel3").getText()</div>
</section>
</section>
</main>
#parse ("/assets/includes/DGDT/inc_footer")
</body>
</html>

7. Change the parts in yellow to point to the includes files you created.

8. Save the template and Publish it.


9. Create a search results page template

1. Navigate to assets > templates.

2. In the folder you created for the general page template, create another template for the search results page and insert the following:

  • Name: e.g. DGDT-search-results
  • Mime Primary Type: text
  • Mime Sub-type: html

3. Click Next.

4. In the Definition XML window, replace <fields></fields> with:

<fields></fields>

5. Click Next.

6. In the Body window, copy and paste the following:

6. Please refer to https://www.swqr.org.uk/web-team/boilerplate/index.html#search.

#set($uniqueId = $resources.resourceForPathSecure("/DGDT/site-info").getId())
#set($related = $pages.retrieve($uniqueId).getParagraph("related").getText())
<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")
<body id="DGDT">
#parse ("/assets/includes/DGDT/inc_header")
<main id="container">
<section>
<h1>Search Results</h1>
#set($page=0)
#set($p=$request.getParameter("p"))
#if($p && !$p.isEmpty())
#set($page=$page.parseInt($p))
#end
#set($q=$request.getParameter("q"))
#set($searchPath = "path:/content/DGDT*")
#set($searchTermWithPath = $q +" AND "+ $searchPath)
#set($noOfPages=0)
#set($sortField="name")
#set($sortOrder=$enums.of('ccc.api.types.SortOrder', 'ASC'))
#set($result=$services.getSearch().find($searchTermWithPath, $sortField, $sortOrder, 20, $page))
#set($one=1)
#set($noOfResultsToDisplayPerPage = $result.noOfResultsPerPage())
#set($currentPageNo = ($result.getPageNo()))
#set($displayedPageNo = ($result.getPageNo()+1))
#set($firstResultOnPage = ($currentPageNo*$noOfResultsToDisplayPerPage)+1)
#set($lastResultOnPage = ($displayedPageNo*$noOfResultsToDisplayPerPage))
#set($lastResultOnLastPage = ($result.totalResults()))
#set($noOfResultsToDisplayPerPageMinus1 =($result.noOfResultsPerPage()-$one))
#set($noOfPages = ($result.totalResults()+$noOfResultsToDisplayPerPageMinus1)/$noOfResultsToDisplayPerPage)
<p class="resultsheader">
#if ($displayedPageNo==$noOfPages)
$firstResultOnPage - $lastResultOnLastPage
#else
$firstResultOnPage - $lastResultOnPage of $!result.totalResults().
#end
Page $displayedPageNo of $noOfPages
</p>
<h2>Search results for <em>$q</em></h2>
#foreach($hit in $result.hits())
<div class="results">
#set ($hitPage = "")
#if ($resources.exists($hit))
#set($rSibling=$resources.retrieve($hit))
#if ($rSibling.getTitle() != "Site info" && $rSibling.getTitle() != "GoogleSitemap")
#if($rSibling.getType() == "PAGE")
#set ($hitPage = $pages.retrieve($hit))
#end
#set($type = "PAGE")
<h2>
#if ($rSibling.getType() == "PAGE")
#set($parent = $resources.retrieve($rSibling.getParent()))
<span class="searchType">$type</span> <a href="$rSibling.getAbsolutePath()">$parent.getTitle() &gt; $rSibling.getTitle()</a>
#else
<span class="searchType">FILE</span> <a class="file" href="$rSibling.getAbsolutePath()">$rSibling.getTitle()</a>
#end
</h2>
#if($hitPage && $hitPage != "")
#set($snippet = "")
#set($snippet = $hitPage.getParagraph("content").getText())
#if($snippet!="")
#set($snippet = $snippet.replaceAll("<[^>]*>",""))
#set($ls = $snippet.toLowerCase())
#set ($queryText = $html.escape($!q).toLowerCase())
#if($ls.indexOf($queryText) > -1)
#set($begin = 0)
#if($ls.indexOf($queryText) > 90)
#set($begin = $ls.indexOf($queryText) - 90)
#end
#set($end = $ls.length())
#if($end > ($ls.indexOf($queryText) + 90))
#set($end = $ls.indexOf($queryText) +90)
#end
<p>&hellip;$snippet.substring($begin, $end)&hellip;</p>
#elseif($rSibling.getType() == "PAGE")
#set($end = $snippet.length())
#if($end > 100)
#set($end = 99)
#end
<p>&hellip;$snippet.substring(0, $end)&hellip;</p>
#end
#end
#end
#end
#else
#set ($deadResources = $deadResources + 1)
#end
</div>
#end
<p class="resultsheader">Page $displayedPageNo of $noOfPages</p>
#if ( $result.totalResults() > 0)
<p>
#if ($currentPageNo!=0)
<a href="$resource.getName()?p=0&q=$q">&lt;&lt; first</a>
#set ($previousPage = ($currentPageNo - 1))
<a href="$resource.getName()?p=$previousPage&q=$q">&lt; previous</a>
#end
#if ($displayedPageNo < $noOfPages)
#set ($nextPage = ($currentPageNo+1))
<a href="$resource.getName()?p=$nextPage&q=$q">next &gt;</a>
#set ($lastPage = ($noOfPages - 1))
<a href="$resource.getName()?p=$lastPage&q=$q">last &gt;&gt;</a></p>
#end
#end
</section>
<aside>$related</aside>
</main>
#parse ("/assets/includes/DGDT/inc_footer")
</body>
</html>

7. Change the parts in yellow to point to the includes files you created.

8. Change the part in teal if the title of your sitemap differs.

8. Save the template and Publish it.


10. Create a site info page template

1. Navigate to assets > templates.

2. In the folder where you created the general page template, create a template for the site info page and insert the following:

  • Name: e.g. DGDT-site-info
  • Mime Primary Type: text
  • Mime Sub-type: html

3. Click Next.

4. In the Definition XML window, replace <fields></fields> with:

<fields>
<field name="related" type="html" title="Related" description="Related"/>
</fields>

5. Click Next.

6. In the Body window, copy and paste the following:

<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")
<body id="DGDT">
#parse ("/assets/includes/DGDT/inc_header")
<section id="container">
$!resource.getParagraph("related").getText()
$!resource.getId()
</section>
#parse ("/assets/includes/DGDT/inc_footer")
</body>
</html>

7. Change the parts in yellow to point to the includes files you created.

8. Save the template and Publish it.


11. Create a contact page template

1. Navigate to assets > templates.

2. In the folder where you created the general page template, create a template for the contact page and insert the following:

  • Name: e.g. DGDT-contact
  • Mime Primary Type: text
  • Mime Sub-type: html

3. Click Next.

4. In the Definition XML window, replace <fields></fields> with:

<fields>
<field name="header" type="text_field" title="Header" description="Header"/>
<field name="content" type="html" title="Content" description="The content of the main section." />
</fields>

5. Click Next.

6. In the Body window, copy and paste the following:

#set($uniqueId = $resources.resourceForPathSecure("/DGDT/site-info").getId())
#set($related = $pages.retrieve($uniqueId).getParagraph("related").getText())
<!DOCTYPE html>
<html lang="en">
#parse ("/assets/includes/DGDT/inc_html_head")

<body id="DGDT">
#parse ("/assets/includes/DGDT/inc_header")

<main id="container">
<section>
<article id="main_short">
<div>
<h1>$resource.getParagraph("header").getText()</h1>
$resource.getParagraph("content").getText()

<!-- Form success -->
#set ($success = $request.getParameter('success'))
#if ($success)
<p class="success">Thank you for contacting us.</p>
#end

<!-- Form errors -->
#set( $errors = $request.getAttribute('Contact.errors') )

#if( $errors )
<div class="error-summary">
<p class="error"><strong>Please correct the following errors:</strong></p>
<ul>
#foreach( $error in $errors )
<li class="error">$error</li>
#end
</ul>
</div>
#set ($name = $!request.getAttribute('name'))
#set ($email = $!request.getAttribute('email'))
#set ($enquiry = $!request.getAttribute('enquiry'))
#set ($comments = $!request.getAttribute('comments'))
#end

<form id="contactForm" method="post" name="Dangerous Goods Driver Training" action="/assets/scripts/DGDT/contact.js">
<p><span class="required">*</span> <label for="name">Name:</label></p>
<p><input name="name" autocomplete="off" id="name" type="text" value="$!name" required/></p>
<p><span class="required">*</span> <label for="email">E-mail address:</label></p>
<p><input name="email" autocomplete="off" id="email" type="email" value="$!email" required/></p>
<p><span class="required">*</span> <label for="enquiry">Please select your reason for enquiry:</label></p>
<p><select name="enquiry" id="enquiry" title="Enquiry" required="">
<option value="">--- Please select ---</option>
<option value="Option-1">Option 1</option>
<option value="Option-2">Option 2</option>
<option value="Option-3">Option 3</option>
</select></p>
<p id="enquiryInfo"></p>
<p><span class="required">*</span> <label for="comments">Message:</label></p>
<p><textarea name="comments" cols="80" rows="10" id="comments" style="margin-left: 0;" required></textarea></p>
<p>For more details about how SQA uses your personal information, please read our <a href= "https://www.sqa.org.uk/sqa/45397.html">Privacy Statement</a>.</p>
<span class="error" id="recaptchaError" style="display:none; margin-top: 12px;">&nbsp;</span>
<p><input type="hidden" id="g-recaptcha-response" name="g-recaptcha-response"></p>
<p><input type="hidden" name="action" value="validate_captcha"></p>
<p><input type="button" id="submit" value="Submit" onClick="validateAndSubmitForm()"></p> </p>
</form>
</div>
</article>
</section>
<aside>
$related
</aside>
</main>
#parse ("/assets/includes/DGDT/inc_footer")

<script>
var selectElement = document.getElementById("enquiry")
var pElement = document.getElementById("enquiryInfo")
selectElement.addEventListener('change', function() {
var index = selectElement.selectedIndex;
if (index == 0) {
pElement.innerHTML = "";
}
else if (index == 1) {
pElement.innerHTML = "Option 1";
}
else if (index == 2) {
pElement.innerHTML = "Option 2";
}
else if (index == 3) {
pElement.innerHTML = "Option 3";
}
})
</script>

<!-- Google reCAPTCHA -->
<script src="https://www.google.com/recaptcha/api.js?render=0000000000000000000000000000000000000000"></script>
<script>
function validateAndSubmitForm() {
grecaptcha.ready(function() {
grecaptcha.execute('0000000000000000000000000000000000000000', {action: 'validate_captcha'}).then(function(token) {
document.getElementById("g-recaptcha-response").value = token;
HTMLFormElement.prototype.submit.call(document.getElementById("FORM_ID"));
});
});
}
</script>
<!-- End Google reCAPTCHA -->

</body>
</html>

7. Change the parts in yellow. Refer to Google reCAPTCHA and update the section highlighted in teal with your site key.

8. Save the template and Publish it.


12. Create a site info page using a template

1. Select Create folder in the content directory with the name of your site (e.g. DGDT) and Publish it.

2. Select Cog and select Choose template and select the general template you created.

Select default template

This means that when you create a page inside your new folder, it will automatically adopt the general template. You only need to choose a template for a non-normal page (e.g. home, search).

3. In the folder you created with the name of your site, select Create page.

Notice the Use default template is checked? That means that the general template will be adopted. If you decide you don't want to adopt the general template for this particular page, you can select another template.

Select a template

See the 6 templates we have created?

4. Uncheck the Use default template box and select DGDT-site-info.

This will allow us to feature related information across multiple pages on our site.

5. Populate the Related box.

Populate the Related box

6. Save the page and Publish it.

You should have something like this:

Site info page created


13. Create a general page using a template

1. In the folder you created with the name of your site, select Create page.

2. Ensure Use default template is checked.

Default template

3. Populate the Content box.

Populate the Content box

4. Save the page and Publish it.


14. Create a news article page using a template

1. In the folder you created with the name of your site, select Create folder called News and Publish it.

Create folder called News and Publish

Folders within a site folder are used to create sub menus on the main navigation. Any pages that sit inside the folder will appear in the sub menu if the Add to menu option is set to true.

2. Inside the News folder, select Create page.

3. Uncheck the Use default template box and select DGDT-news.

4. Populate the Summary and Content box.

Populate the Summary and Content box

5. Save the page and Publish it.


15. Create a news home page using a template

1. Repeat the instructions in step 14. Create a news article page using a template.

2. Uncheck the Use default template box and select DGDT-news-home.

3. Populate the Name box with News.

4. Save the page and Publish it.

5. Set the News folder index page as the news home page.

Set the News folder index page

6. Save.


16. Create a search results page using a template

1. In the folder you created with the name of your site, select Create page.

2. Uncheck the Use default template box and select DGDT-search-results.

3. Populate the Name box with Search-results.

4. Save the page and Publish it.


17. Create a home page using a template

1. In the folder you created with the name of your site, select Create page.

2. Uncheck the Use default template box and select DGDT-home.

3. Populate the Content box.

4. Save the page and Publish it.

5. On the Home page, select Cog and select Add to menu.

Add to menu creates a link to that particular page on the main navigation.

Preview of page

If you require a submenu, create a folder within the folder you just created and name it with the name of the link (e.g. Schools). Repeat steps 3 - 5 and don't forget to publish the folder.


18. Create a contact page using a template

1. In the folder you created with the name of your site, select Create page.

2. Uncheck the Use default template box and select DGDT-contact.

3. Populate the Content box.

4. Save the page and Publish it.


19. Create a thank you page

1. In the folder you created with the name of your site, select Create page.

2. Ensure Use default template is checked.

Default template

3. Populate the Content box. Name the page Thank-you.

Thank you content page

4. Save the page and Publish it.


20. Create a site map

1. Request CIVIC to re-index the site overnight.

2. Request site map from CIVIC.

3. Submit site map to Google Search Console.

4. Build HTML site map using SortSite.

5. Add HTML site map to footer include.


21. Implement Google Tag Manager

1. Navigate to Google Tag Manager and sign in.

Google Tag Manager

2. Select Options and select Create Container.

Create Container

3. Name the container the name of your site (e.g. DGDT).

4. Select Web as your target platform.

Container Settings

5. Select Create.

GTM code

6. Copy the <script> and paste it in your cookie-control-v9.js.

7. Copy the <noscript> and paste it at the top of your inc_header, ensuring the GTM-0000000 reflects your Container ID.


© 2020 Scottish Qualifications Authority