WET Template Customization

This document explains how RAMP handles the localization of text in different scenarios.

Structure

RAMP pulls in WET core repo as a dependency and uses its template engine to assemble RAMP html pages. The local copy of WET is stored in ./lib/wet-boew. All RAMP-specific templates are stored in ./site folder.

When building a RAMP Theme (Intranet, Usability, or Canada.ca), RAMP pull a corresponding WET Theme as a dependency and stores in ./lib folder.

RAMP HTML pages, ramp-en.html and ramp-fr.html are generated from ./site/pages/ramp.hbs Handlebars template which uses ./site/layouts/default.hbs layout. Both the main template and the layout use a number of partials, helpers, and data files.

Note

Please, avoid modifying WET templates and partials inside ./lib folder. Use instructions below to properly override templates.

RAMP Core

When building RAMP Core, the build tool uses WET templates unless they are overridden by custom RAMP templates.

Partials

The build tool looks up partial templates at the following paths where successive partials with the same names will override previous ones:

  1. lib/wet-boew/site/includes/**/*.hbs
  2. site/includes/**/*.hbs

To override a WET partial that is not included in the ./site/includes, copy over a corresponding partial from ./lib/wet-boew/site/includes and modify it.

Helpers

The build tool looks up Handlebars helpers at the following paths:

  1. lib/wet-boew/site/helpers/helper-*.js
  2. site/helpers/helper-*.js

To add a new helper, place it in the ./site/helpers/ folder.

Data

Specifies the data to supply to the templates. Data may be formatted in JSON, YAML, YAML front matter, or passed directly as an object. Wildcard patterns may also be used. The build tool looks up data files at the following paths:

  1. lib/wet-boew/site/data/**/*.{yml,json}
  2. site/data/**/*.{yml,json}

Default WET template data is in the ./lib/wet-boew/site/data/site.json. This file contains a list of non-language-specific stings related to the whole site such as title and descriptions. To override, create a site.json file in ./site/data. To augment, copy the original file from ./lib/wet-boew/site/data/site.json to ./site/data/site.json and modify it.

Read about localization data in Localization.

RAMP Themes

When building RAMP Theme, there are two more lookups when searching for templates and partials.

Partials

The build tool looks up partial templates at the following paths where successive partials with the same names will override previous ones:

  1. lib/wet-boew/site/includes/**/*.hbs
  2. lib/ramp-pcar/site/includes/**/*.hbs
  3. lib/theme-gcwu-fegc/site/includes/**/*.hbs or lib/theme-gc-intranet/site/includes/**/*.hbs or lib/gcweb/site/includes/**/*.hbs depending on the theme
  4. site/includes/**/*.hbs

To override a WET partial that is not included in the ./site/includes, copy over a corresponding partial from ./lib/[wet-theme-name]/site/includes and modify it.

Helpers

The build tool looks up Handlebars helpers at the following paths:

  1. lib/wet-boew/site/helpers/helper-*.js
  2. lib/ramp-pcar/site/helpers/helper-*.js
  3. lib/theme-gcwu-fegc/site/helpers/helper-*.js or lib/theme-gc-intranet/site/helpers/helper-*.js or lib/gcweb/site/helpers/helper-*.js depending on the theme
  4. site/helpers/helper-*.js

To add a new helper, place it in the ./site/helpers/ folder.

Data

Specifies the data to supply to the templates. Data may be formatted in JSON, YAML, YAML front matter, or passed directly as an object. Wildcard patterns may also be used. The build tool looks up data files at the following paths:

  1. lib/wet-boew/site/data/**/*.{yml,json}
  2. lib/ramp-pcar/site/data/**/*.{yml,json}
  3. lib/theme-gcwu-fegc/site/data/**/*.{yml,json} or lib/theme-gc-intranet/site/data/**/*.{yml,json} or lib/gcweb/site/data/**/*.{yml,json} depending on the theme
  4. site/data/**/*.{yml,json}

To override, create a site.json file in ./site/data. To augment, copy the original file from ./lib/[wet-theme-name]/site/data/site.json to ./site/data/site.json and modify it.

Read about localization data in Localization.

Date modified: