Theme Development Conventions ============================= This document covers the conventions for developing Shopyo themes, including how bundled pip-package themes work, required template sections, and theme resolution order. Theme Types ----------- Shopyo has two theme categories: - **Front theme** — public-facing pages (shop, blog, homepage) - **Back theme** — admin dashboard and internal tools Theme Resolution ---------------- When a theme is activated, its directory is resolved in this order: 1. **Blueprint static folder** — if the theme name is namespaced as ``/`` (e.g., ``shopyo_theme/blogus``), the theme is served from that blueprint's ``static/themes/{front|back}/`` directory. 2. **App static folder** — otherwise, the theme is looked up in a normal ``static/themes/{front|back}/``. For example, ``shopyo_theme/blogus`` resolves to ``shopyo_theme/static/themes/front/blogus/``, while plain ``blogus`` resolves to ``static/themes/front/blogus/``. Package-Based Themes -------------------- Themes bundled in pip packages are placed in the package's ``static/themes/{front|back}//`` directory. The package's blueprint must have a ``static_folder="static"`` set so that ``url_for('.static', filename=...)`` works. Required File Structure ----------------------- Every theme (front or back) must contain at least: .. code-block:: text / ├── info.json # Theme metadata ├── styles.css # Main stylesheet ├── sections/ │ ├── nav.html # Navigation bar │ ├── footer.html # Page footer │ ├── resources.html # CSS/JS link tags │ └── drawer_head.html # Mobile drawer head └── (other assets as needed) info.json — Theme Metadata --------------------------- Every theme must have an ``info.json`` at its root: .. code-block:: json { "author": { "name": "Author Name", "website": "https://example.com", "mail": "author@example.com" }, "version": "1.0.0", "display_string": "Theme Display Name" } ``display_string`` is shown in the admin theme picker. ``version`` is used for cache-busting the stylesheet URL. Required Template Sections ---------------------------- Front themes must provide these include-able templates under ``sections/``. The shop templates reference them via ``get_active_front_theme()``: ``sections/resources.html`` Renders ```` and ``