In Drupal 8, themes are collections of files that define how your website looks. They control page layout, colours, fonts, text styling, and much more.
Themes can be created from scratch, downloaded from the Drupal repository, or purchased from third-party vendors. Theme files must be placed in the Drupal 8 themes folder before they can be activated on your site. Drupal also includes a number of pre-installed themes, which are located in the core/themes folder of your installation.
Drupal’s developers recommend placing downloaded or other “contributed” themes in a sub-folder, named “contrib” and your own themes in a folder named “custom”. Each theme should then be placed in its own folder. Note that the folder name:
- Must be lowercase.
- Must start with a letter.
- Must use an underscore (_) instead of spaces.
A typical Drupal installation file and folder structure could look like the following:
|-core | |-modules | |-themes | | |-bartik | | |-seven .. |-modules |-themes | |-contrib | | |-heaven | | |-bold | | |-rouge | |-custom | | |-pixelnine
Theme folder structure
Within each theme folder, the file structure could look like the following example:
|-pixelnine.breakpoints.yml |-pixelnine.info.yml |-pixelnine.libraries.yml |-pixelnine.theme |-config | |-install | | |-pixelnine.settings.yml | |-schema | | |-pixelnine.schema.yml |-css | |-style.css |-js | |-pixelnine.js |-images | |-buttons.png |-logo.png |-screenshot.png |-templates | |-maintenance-page.html.twig | |-node.html.twig
Common theme filetypes
Drupal 8 themes use the following common filetypes and folders:
Defines meta data, libraries, and block regions. This is the only required file in the theme.
Defines where responsive theme designs need to change, in order to be correctly presented on different devices.
A PHP file that contains the conditional logic and data (pre)processing of the output for the theme.
Typically holds Cascading Style Sheet (CSS) files with formatting rules for the theme. CSS files must be defined in libraries.yml and can be overridden or removed in info.yml.
Images files used in the theme are stored in this folder.
A screenshot preview of the theme, used to illustrate the theme entry in the Drupal Appearance page.
The theme’s logo file, stored in SVG (Scalable Vector Graphics) format. Logos can also be uploaded at Appearance > Settings.
Provide HTML markup and some presentation logic.
If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.