Yireo_ThemeByRoute

PHP 8.1 - 8.4
Magento 2.4.7 | 2.4.8
CSP Yes
Latest Release 1.1.2

Magento version PHP version License Latest Version

Magento 2 module to allow a file app/etc/theme-by-route.json to determine which theme needs to be loaded for which route.

Installation

composer require yireo/magento2-theme-by-route
bin/magento module:enable Yireo_ThemeByRoute

Configuration

Create a file app/etc/theme-by-route.json similar to the following:

{
  "Loki/luma": [
    "cms/index/index"
  ]
}

Now, the Loki/luma theme is applied to all pages.

If you want to control under which circumstances which theme is applied, there is an advanced syntax as well:

[
  {
    "scope_type": "website",
    "scope_code": "default",
    "theme": "Loki/luma",
    "pages": [
      "cms/index/index"
    ]
  }
]

Current status

Static Tests Unit Tests Integration Tests Playwright DI Compilation

Support

For getting support, create an Issue under the following project URL:

https://github.com/yireo/Yireo_ThemeByRoute

Module Dependencies

The following dependencies are declared in the module its `etc/module.xml` file:

Magento_Csp Magento_Directory Magento_Store Magento_Theme
Composer details
Magento module name
Yireo_ThemeByRoute
Composer name
yireo/magento2-theme-by-route
Composer version
1.1.2
Default branch
master
Requirements
ext-pcre: *
magento/framework: ^103.0
magento/module-store: ^101.1
magento/module-theme: ^101.1
psr/log: ^1.0 || ^2.0 || ^3.0
php: >=8.2 <8.6
Releases
1.1.2 23 October 2026
1.1.1 23 October 2026
1.1.0 23 October 2026
1.0.3 23 October 2026
1.0.2 23 October 2026
1.0.1 23 October 2026
1.0.0 23 October 2026
Changelog

[1.1.2] - 01 December 2025

Fixed

  • Add enabled config option

[1.1.1] - 22 October 2025

Fixed

  • Allow psr/log 1 and 2 besides 3

[1.1.0] - 22 October 2025

Added

  • Add advanced syntax

[1.0.3] - 30 September 2025

Fixed

  • Fix matching of request URI

[1.0.2] - 30 September 2025

Fixed

  • Also do a direct match on URLs

[1.0.1] - 10 September 2025

Fixed

  • Change JSON filename to app/etc/theme-by-route.json
  • Better README

[1.0.0] - 09 September 2025

Added

  • Copy generic CI/CD files
  • Adding all files to git via Yireo Command
  • Initial release

Last modified: October 17, 2026