# SoftTemplates preset library

This folder holds the presets bundled with the plugin. The same layout is used for the online
library (for example a public GitHub repository), so publishing new presets is a copy of this folder.

```
index.json                 list of presets
templates/<id>.json        one template per preset (Elementor export format)
thumbnails/<id>.svg|png    preview image, about 600 × 360
```

## index.json

```json
{
  "schema": 1,
  "name": "SoftTemplates Library",
  "presets": [
    {
      "id": "header-classic",
      "title": "Classic Header",
      "type": "softtemplate_header",
      "category": "header",
      "tags": ["logo", "menu", "search"],
      "description": "Logo on the left, menu in the middle and a search icon on the right.",
      "version": "1.0.0",
      "min_plugin_version": "1.1.0",
      "pro": false,
      "requires": ["container"],
      "file": "templates/header-classic.json",
      "thumbnail": "thumbnails/header-classic.svg"
    }
  ]
}
```

- `type`: `softtemplate_header`, `softtemplate_footer`, `softtemplate_single`, `softtemplate_archive`,
  `softtemplate_page` or `softtemplate_section`.
- `file` and `thumbnail` are paths relative to the folder (no `..`, no absolute URLs).
- `version`: an online preset with the same `id` and a higher or equal version replaces the bundled one.
- `min_plugin_version`: hidden on sites running an older plugin.
- `pro`: shown with a "Pro" badge and locked until a Pro add-on reports itself through the
  `soft-template-core/library/pro-active` filter.
- `requires: ["container"]`: hidden when Elementor's Container feature is off.

## Template files

Use **Templates > My templates > Export** (the download icon) in the SoftTemplates dashboard.
The file contains `version`, `title`, `type`, `content` and `page_settings`; display conditions are
never exported or imported. Online presets are always cleaned of scripts on import.

## Publishing on GitHub

1. Create a public repository and copy `index.json`, `templates/` and `thumbnails/` into it.
2. Use the raw URL of the folder, e.g. `https://raw.githubusercontent.com/<org>/<repo>/main/`.
3. Set it as `SOFT_TEMPLATE_LIBRARY_URL` at the top of `soft-template-core.php`
   (or use the `soft-template-core/library/url` filter).
4. Sites refresh the online list every 12 hours; **Templates > Library > Refresh** loads it at once.
