In Drupal 10, the directory structure is organized to separate various aspects of the system, including core files, contributed modules, custom modules, themes, and more.In Drupal 10, the directory structure is organized to separate various aspects of the system, including core files, contributed modules, custom modules, themes, and more.
-
Drupal Root Directory
- Directories directly under Drupal root, i.e. where the Drupal package is installed
- index.php: The main entry point for the application.
- composer.json: The Composer configuration file for dependency management.
- core/: Contains Drupal's core files and essential components.
- modules/: This folder contains modules, both contributed and custom.
- themes/: Contains themes, including both custom and contributed themes.]
- sites/: This folder is where settings, configurations, and files related to specific Drupal sites are stored.
- libraries/: Typically used for third-party libraries that Drupal relies on.
- vendor/: Contains external dependencies managed by Composer.
- update.php: The script used to perform database updates.
- robots.txt: For controlling web crawlerscomposer.lock: Ensures that the same versions of dependencies are installed across environments.
- Directories directly under Drupal root, i.e. where the Drupal package is installed
-
Detail of main Directories
-
core/
- Contains the essential code for Drupal's core functionality, including: (Generaly you need not change any thing here)
- modules/: Core modules for features like user management, content types, etc.
- themes/: Core themes like Seven (admin theme), Bartik (default theme).
- lib/: Provides libraries for essential functions.
- includes/: Contains essential PHP functions.
- translations/: Core translations for various languages.
- tests/: Core automated tests.
-
modules/
- contrib/: This directory houses contributed modules (e.g., from drupal.org).
- custom/: For custom modules created for your specific Drupal site.
-
themes/
- contrib/: Contains contributed themes from drupal.org.
- custom/: Houses custom themes created for your Drupal site.
-
sites/
- default/: This is the default directory for configuration and files, such as:
- settings.php: Configuration file where database and other settings are stored.
- files/: Where user-uploaded files (e.g., images, documents) are stored.
- config/: Contains configuration files (either exported or synchronized from the configuration management system).
- private/: Contains private files not directly accessible via the web.
- If you have multiple sites, you can create subdirectories like sites/sitename/ for specific configurations.
- default/: This is the default directory for configuration and files, such as:
-
vendor/
- Managed by Composer, this directory holds third-party PHP libraries that Drupal and its modules require.
-
-
Example Directory Structure
-
drupal-10.x/
├── core/
│ ├── modules/
│ ├── themes/
│ ├── lib/
│ ├── includes/
│ └── translations/
├── modules/
│ ├── contrib/
│ └── custom/
├── themes/
│ ├── contrib/
│ └── custom/
├── sites/
│ ├── default/
│ │ ├── settings.php
│ │ ├── files/
│ │ ├── config/
│ │ └── private/
│ └── example.com/
├── vendor/
├── index.php
├── composer.json
├── composer.lock
└── update.php
-
Main category