<commit_before># 📝Creating custom templates

A custom template is a folder composed by a `template.json`, one or more HTML file with a `*.njk` extension and all the resources files (CSS, Javascript, fonts, images, etc).

Example of a template folder:

- template.json
- index-onepage.njk
- index-multipage.njk
- script-multipage.njk
- css/
  - bootstrap.css
  - styles.css
- js/
  - main.js

Each ***template*** have multiple ***designs***. Each design is a variation of your template. *For example*, posible designs for one imaginary template are: `onepage-blue`, `onepage-orange`, `multipage-blue` and `multipage-orange`.

## template.json

The `template.json` file describes your template, and each design that your template supports.

```json
{
    "author": "<NAME>",
    "description": "TEMPLATE SHORT DESCRIPTION",
    "web": "YOUR WEB OR GITHUB URL",
    "defaultDesign": "onepage",
    "designs": {
        "onepage": {
            "displayName": "One Page Awesome",
            "copy": ["css/**/*", "js/**/*"],
            "pages": [
                {"in": "index.njk", "out": "index.html", "feedWith": "scripts"}
            ]
        }
    }
}
```

### Template<commit_msg>Update documentation<commit_after># 📝Creating custom templates

A custom template is a npm package composed by a `template.json`, one or more HTML file with a `*.njk` extension and all the resources files (CSS, Javascript, fonts, images, etc).

Example of a template folder:

- package.json
- template.json
- index-onepage.njk
- index-multipage.njk
- script-multipage.njk
- css/
  - bootstrap.css
  - styles.css
- js/
  - main.js

Each ***template*** have multiple ***designs***. Each design is a variation of your template. *For example*, posible designs for one imaginary template are: `onepage-blue`, `onepage-orange`, `multipage-blue` and `multipage-orange`.

## Creating a package.json file

First, create a folder named `docs_gm-YOURTEMPLATENAME`. For example: if your template name is `red-wave`, then your folder name (and package name) must be `docs_gm-red-wave`. And from the comand line:

```bash
npm init
```

Follow the instructions.

- The `name` of the package must be your folder name. For example: `docs_gm-red-wave`.
- The `main` file must be `template.json`.
- In the `keywords` section, add at least one keyword that is `docs_gm`.
- All the other values can be anything you want.

> When you **FINISH** creating your template following this document, then you can use `npm publish` to publish the template on the npm registry.

> If you want to test your template while you are developing it, use `npm link` to simulate that your package is installed on the system.

Then, create your template.json file:

## template.json

The `template.json` file describes your template, and each design that your template supports.

```json
{
    "author": "<NAME>",
    "description": "TEMPLATE SHORT DESCRIPTION",
    "web": "YOUR WEB OR GITHUB URL",
    "defaultDesign": "onepage",
    "designs": {
        "onepage": {
            "displayName": "One Page Awesome",
            "copy": ["css/**/*", "js/**/*"],
            "pages": [
                {"in": "index.njk", "out": "index.html", "feedWith": "scripts"}
            ]
        }
    }
}
```

### Template
{'fraction_non_alphanumeric': 0.13470389690088985, 'fraction_numerical': 0.0, 'mean_word_length': 3.22279792746114, 'pattern_counts': {'":': 24, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2838094', 'n_tokens_mistral': 1006, 'n_tokens_neox': 963, 'n_words': 374}