Clone

Generating multiple sites

While the mustache templates are rendered in execution time, the generator templates are executed before the server starts and produces all the needed versions of the mustache templates.

Directory structure

The generator needs to have a known folder structure in order to operate properly. Let’s see a typical directory structure the generator knows to use:

your_project/
├── config
│   ├── ca-ES
│   │   ├── config.ini
│   │   └── routes.ini
│   └── global
│       ├── config.ini
│       └── routes.ini
├── i18n
│   ├── ca-ES.ini
│   ├── en-US.ini
│   └── zh-CN.ini
└── sources
    ├── ca-ES
    │   └── static
    │       ├── 1234567890.txt
    │       └── 505
    └── global
        ├── Dockerfile
        ├── config.json
        ├── static
        │   ├── 404
        │   ├── robots.txt
        │   └── sitemap.xml
        └── tmpl
            └── home.mustache

Notice that there is a global folder inside sources and config. These files will be present in any language but if a folder with an ISO code declares the same file it will be overwritten, if it is new, it will be added to the language only.

Output after running the generator

After running the generator the following output will be created:

your_project/
...
└── output
   ├── ca-ES
   │   ├── Dockerfile
   │   ├── config.json
   │   ├── static
   │   │   ├── 1234567890.txt
   │   │   ├── 404
   │   │   ├── 505
   │   │   ├── robots.txt
   │   │   └── sitemap.xml
   │   └── tmpl
   │       └── home.mustache
   ├── en-US
   │   ├── Dockerfile
   │   ├── config.json
   │   ├── static
   │   │   ├── 404
   │   │   ├── robots.txt
   │   │   └── sitemap.xml
   │   └── tmpl
   │       └── home.mustache
   └── zh-CN
       ├── Dockerfile
       ├── config.json
       ├── static
       │   ├── 404
       │   ├── robots.txt
       │   └── sitemap.xml
       └── tmpl
           └── home.mustache

Now all this files are final templates (and not meta-templates). Notice how the 505 and 1234567890.txt files exist only in the ISO ca-ES.


Continue to Running the generator

← Back to Multi site generator