> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kiwify.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Templates

> JSON files that define page structure and content

# Templates

<Info>
  Templates define the structure of pages in your Members Area. They serve as data storage for the visual theme editor and determine which sections appear on a page.
</Info>

## Available Templates

Currently, only two pages can be customized:

* **Login page** (`login.json`) - The authentication page
* **Home page** (`index.json`) - The main dashboard page

These files follow a fixed structure and cannot be deleted or renamed. You also cannot create new pages in this folder.

## Template Format

<Tabs>
  <Tab title="Schema Structure">
    Templates are JSON files with a specific schema:

    ```json theme={null}
    {
      "order": ["section-id-1", "section-id-2", "section-id-3"],
      "sections": {
        "section-id-1": {
          "type": "banner",
          "settings": { 
            // Section settings
          },
          "blocks": {
            // Optional blocks within the section
          },
          "block_order": ["block-id-1", "block-id-2"]
        },
        "section-id-2": {
          "type": "modules",
          "settings": {
            // Section settings
          }
        }
        // Additional sections...
      }
    }
    ```
  </Tab>

  <Tab title="Properties">
    | Property                   | Type   | Description                                       |
    | -------------------------- | ------ | ------------------------------------------------- |
    | `order`                    | Array  | List of section IDs in rendering order            |
    | `sections`                 | Object | Map of section IDs to section configurations      |
    | `sections[id].type`        | String | The section type (must match a section file name) |
    | `sections[id].settings`    | Object | Configuration values for the section              |
    | `sections[id].blocks`      | Object | Optional blocks within the section                |
    | `sections[id].block_order` | Array  | Order of blocks within the section                |
  </Tab>

  <Tab title="Example">
    ```json theme={null}
    {
      "order": ["banner", "featured-modules", "continue-watching"],
      "sections": {
        "banner": {
          "type": "banner",
          "settings": { 
            "slides_delay": 5 
          },
          "blocks": {
            "slide-1": {
              "id": "slide-1",
              "type": "slide",
              "settings": {
                "banner_type": "image",
                "mobile_image": "https://example.com/mobile.jpg",
                "desktop_image": "https://example.com/desktop.jpg"
              }
            }
          },
          "block_order": ["slide-1"]
        },
        "featured-modules": {
          "type": "modules",
          "settings": {
            "external_section_id": "featured-modules",
            "items_variant": "content_over",
            "title": "A section can contain modules",
            "course_id": "course-id-example"
          }
        },
        "continue-watching": {
          "type": "continue_watching",
          "settings": {
            "external_section_id": "continue-watching",
            "items_variant": "content_over",
            "margin_top": 20
          }
        }
      }
    }
    ```
  </Tab>
</Tabs>

## Limitations

<Warning>
  * Templates are auto-generated files that can be edited by both the code editor and theme editor
  * Each template can render up to 25 sections
  * Each section can have up to 50 blocks
</Warning>

## How Templates Work

When you edit a template in the theme editor:

1. The theme editor reads the template JSON file
2. It renders UI controls based on section schemas
3. Any changes you make are saved back to the JSON file
4. The page is re-rendered with your changes

You can also edit these files directly in the code editor by clicking "Code Editor" button.
