Drupal 8 is a tool designed to meet the needs of the most ambitious web projects. We hear a lot about the notions of headless, API first, decoupling, etc. that resolutely allow solid architectures for ambitious projects. But this does not mean that Drupal 8 no longer propels more traditional, and sometimes even much less ambitious sites: simple, small, and even large, websites, but for which we want to benefit from the modularity, flexibility and robustness of Drupal.
Drupal 8, an industrialization solution for small or large sites
Drupal is also a solution that offers different possible architectures to industrialize the production of websites. A recurring need, that of being able to generate and manage multiple sites simply and quickly, often comes up again for projects whose ambition is not the complexity of a single site but the simplicity of managing a multitude of sites, more or less complex.
Drupal 8 offers us several possible solutions to industrialize website production: the multi-site architecture native to Drupal 8, and the Domain Access module.
The Drupal native multi-site architecture allows to generate and maintain multiple independent Drupal 8 sites that are based on the same foundation, the same base of the Drupal core and its contributed modules, while Domain Access offers to power different sites from a single Drupal 8 instance by simply separating content by means of access rights. Nevertheless, each of these solutions has its advantages and disadvantages. The maintenance of a multitude of Drupal 8 instances on a multi-site architecture can quickly become complex and time-consuming and one of its advantages, time to market, can be mitigated depending on the more or less complex organization within a structure and its IT. While Domain Access may require many adaptations, or even meet certain limits, as soon as the number of powered sites, or according to the different nature of the desired sites, reaches a certain stage.
After this brief introduction of the available solutions for a Drupal web-factory, the purpose of this post is not to go into the details of each of them, but to present a possible third way, based on the Micro Site module, and its many contributed modules.
Powering a multitude of Micro Sites with Drupal 8
The main idea of the multi-site architecture proposed by the Micro Site module is based on the following main idea:
Be able to publish a new site as easily and quickly as publishing a blog post
In fact, its concept can be compared to the multi-site solution proposed by Typo 3, and perhaps even inspired much of the genesis of the Micro Site module.
Typo 3 allows an administrator, or even a simple webmaster, to simply create a new site, configure its URL and some basic properties (name, logo, etc.), assign users to this new site and delegate rights to them, then simply publish pages linked to this new site to quickly have an autonomous site both in content and management, while being managed and maintained from a single interface.
Like Typo 3's multi-site solution, the Micro Site module is designed to:
- Enable you to drive and manage hundreds (and more if necessary) of sites within the same Drupal 8 instance
- Delegate management rights for a Micro Site within a dedicated and simplified administration space
- Allow content and user sharing between Micro Sites.
- Minimize adherence to a complex IT infrastructure
- Allow an online launch, a time to market, extremely reduced
- And benefit from all the modularity of Drupal to enable you to power Micro Sites with different properties
The Micro Site module (and its peripheral modules) can be used in many ways: dedicated sites for each department or laboratory of a university, event sites, partner sites, brand sites, allowing a federation or association to offer its members a packaged, ready-to-use website while facilitating content sharing and a common user base, any enterprise which wants master its multiple internet presence, and in general, to easily and simply propel and manage a galaxy of websites, from a few dozen to several hundred.
Architecture of the Micro Site module
The architecture of Micro Sites is extremely similar to the Domain Access module in that the Drupal 8 low-level access rights system is used to separate content between Micro Sites, but differs in one fundamental aspect: while Domain Access relies on configuration entities to define and create the different sites powered by a single instance, the Micro Site module relies on a content entity that will be used to provide the URL of the Micro Sites and many other things, such as giving users of a Drupal 8 instance, who are not administrators, the ability to independently create and publish a Micro Site.
By relying on a content entity, Micro Site allows you to natively customize at will, with simple site building and theming, simply by using the modularity offered by Drupal 8, the different types of Micro Site you want to be able to power. So for example:
- The home page of a micro site is constituted by the content entity Site itself and can therefore be customized at will without any adherence to a general configuration of the Master Drupal instance.
- By a simple site building and theming game, all the fields added on a Micro Site entity can be used on all the contents constituting the micro site. Thus the footer of a micro Site can be configured in a few clicks, and a template modification, by simply adding a few dedicated fields on the content entity provided by Micro Site.
- Any customization, complex business need, for a type of Micro Site can be added by simply using the Drupal 8 eco-system.
Micro Site, the solution that even makes coffee?
Like any industrialization solution, except to be the ultimate universal solution, the grail finally found, which even makes coffee, Micro Site has its strengths and weaknesses compared to other industrialization solutions. If the Drupal 8 native multi-site architecture, because each instance of the website factory is a complete, independent Drupal 8 site, allows you to benefit out of the box from the entire ecosystem of Drupal 8 contributed modules, this is less true with a Micro Site based architecture.
Some modules will be able to run out of the box, without specific integration, due to their nature (a module that provides a specific field widget such as jQuery minicolors, for example, or the Paragraphs module), other modules will require a very light integration, by a simple modification of their configuration, such as the Matomo module, while modules providing content entities (such as the Bibliography & Citation module or Simplenews) will require a more complete integration.
Micro Sites natively have a simplified management of users and their related rights on a Micro Site and its associated content. The idea is to cover 80% of use cases with an immediate, simple and effective solution. Thus a Micro Site has as standard 4 types of users (in addition to the owner of the Micro Site) who are:
- Administrators: who have all the rights
- Content managers: who have modification rights on all content linked to a micro site
- Contributors: who can publish content related to a Micro site, and modify their own content
- Members: who can simply view unpublished content
Concerning more complex or more specific needs, Micro site is not intended to deal with them natively. But quite simply, these needs can be addressed with a few alterations, or the addition of specific fields, and the application of their business logic by means of a customized module.
Micro Site is therefore not the ultimate solution that will be able to cover all cases of use in a few clicks. On the other hand, it offers you a solid architecture, an administration space and the APIs necessary for any alteration to achieve the desired result. And for the most common uses and needs, it is possible to create and modify your Micro Sites in the same way that you can manage different types of content with Drupal 8.
The Micro Site ecosystem
Micro Site is the core module, providing the Site entities, as well as the main APIs. Nevertheless, with only the Micro Site module, we are only able to create a micro site of the One Page type, a unique page that will be created by the Site entity itself. But several modules extend the capabilities of Micro Sites, allowing to go beyond the framework of a simple One Page site, the main ones being the following.
Micro Node is the module that allows you to integrate node (and thus any content type) within a Micro Site. Thus it allows to configure within a Master instance the different content types that will be available for Micro sites. These parameters can then be modulated for each type of Micro Site. And we can publish content on a Micro Site, or several Micro Sites, or even on all Micro Sites.
Micro Menu Menu
The Micro Menu module allows you to create a Menu and allocate it exclusively to a Micro Site. In addition, it allows an automatic selection of this menu when editing or creating content, allowing to directly associate a content to an entry in this menu when you are in the context of a Micro Site.
The Micro Theme module allows you to declare for each activated theme whether it can be used by a Micro Site. By default Micro Sites will use the default theme, but it is then possible to assign each Micro Site a different theme according to the needs. In addition, the Micro Theme module offers an interface to dynamically modify certain colors of the theme, the fonts used, similar to what can be found with the Core Color module. By default, this interface proposes a certain number of colors that can be configured, variables that can be extended, and for which it will be necessary to provide a corresponding CSS file, thus allowing this interface to be adapted to any theme used.
The Micro Taxonomy module allows to integrate the taxonomy of a Drupal 8 instance with the Micro Sites. On the one hand, by allowing a dedicated vocabulary to be allocated to each Micro Site, but also by making common vocabularies accessible to different types of Micro Sites, allowing them to consume or create taxonomy terms within these common and shared vocabularies.
The Micro Path module allows you to automatically manage aliases of identical URLs on several Micro Sites. Thus two contents published on two different Micro Sites can have the same alias. In addition, this module also allows you to create automatic alias patterns specific to a Micro Site, for the content types available, allowing you to modify automatic alias patterns configured in a general way on the Master instance.
The Micro SSO module allows to set up an SSO authentication from the master instance to each Micro Site.
The Micro User module allows you to control at the level of each Micro Site and/or Master instance which user can connect to a Micro Site or to the Master instance. Its functional scope is awaiting use cases that may require an extension of its functionalities.
The Micro Sitemap module allows you to integrate the Sitemap module into the context of each Micro site, allowing you to customize an automatic site map from each Micro site.
The Micro Contact module allows to integrate the Drupal 8 Contact module within each Micro Site, with the possibility to configure which contact form, configured on the Master instance, to use for each Micro Site. Note that the use of Webform forms can be done with a simple construction of a Paragraph allowing to load and render a Webform form, and as such a specific integration is not necessary.
Micro Simple Sitemap
The Micro Simple Sitemap module allows you to generate a sitemap.xml file for each Micro site. Note that this module integrates the Simple Sitemap module in its current version 2.x, and therefore all its parameters made on a master instance, but that it is not excluded to use a simpler method, in an autonomous way, to generate XML sitemap files for each Micro Site.
The Micro Bibcite module allows you to integrate the Bibliography & Citation module with a Micro Site. To date, only the Reference content entities provided by this module are supported.
In the end, these different modules make it possible to publish micro sites that can meet many editorial needs.
Brief overview of the functionalities of a Micro Site
As a preamble, due to the Bypass content access control permission automatically assigned to the User-1, it is advisable not to use this specific user in managing a Drupal instance with the Micro Site module, and therefore the special Administrator role. Otherwise, this user will have the unpleasant surprise of seeing all the content published on all the Micro Sites and all this happily mixed up. You must therefore create a new Role, to which you can assign all rights, except the Bypass content access control right, and assign this role to an administrator. This until this issue Remove the special behavior of uid #1 has been resolved.
The Micro Site module provides the basic architecture to create and publish a new site, with a new Site content entity. It also provides a general configuration of the Master instance. The first action to be performed will be to globally configure the base URL of the Master instance that powers the Micro Sites, as well as the public URL of this instance (which can be the same as the base URL).
We can globally configure what content types will be available for use by Micro Sites. These parameters can be modulated by type of Micro Site.
We can also configure which vocabularies can be used by Micro Sites. These parameters can also be modulated by type of Micro site.
Creating Micro Site Types
Then it is possible to create different types of sites (One Page, Generic, Event, Department, Department, Brand, etc.) to be able to configure them differently.
Each Site type can be configured differently, depending on the options offered by the contributed modules, such as Micro Node or Micro Taxonomy.
Thus it is of course possible to add as many fields as necessary on a site type, just like a content type, but also to configure some general options that will then be available for all Micro Sites of this type that will be created. We can configure for each type of site:
- The automatic creation of a dedicated menu for each Micro site
- The automatic creation of a dedicated vocabulary reserved exclusively for each Micro Site created
- The possibility to manage users and their different profiles on each Micro site of this type
- The different types of content present on the master instance that can be used by each Micro Site
- The different vocabularies present on the master instance that can be used by each Micro site
Management and creation of Micro Sites
Micro Sites can then be created and managed as the content types of a Drupal 8 project.
A Micro Site has two statuses: Registered and Published.
The Registered status will validate the URL of the Micro Site, as well as the presence of a valid Virtual Host. As soon as a Micro Site is Registered, any access to the Micro Site automatically returns to the URL of the Micro Site. The Registered status conditions access to the menus for managing and creating content associated with a Micro Site. In other words, it is impossible to start creating content associated with a Micro Site until it has been registered.
The Published status is more classic. An unpublished site will only be visible by its author, or its members (and if they have the appropriate permission), as well as any content associated with an unpublished Micro Site.
Management of a Micro site
The main idea here is that a micro site can be administered completely independently of the Master instance by simple users. Ultimately, a manager of a micro site may not even know that his site is hosted on a master Drupal instance. A Micro Site has an administration area accessible from the Local Tasks on the Micro Site home page.
Thus we can customize at will the different screens that can constitute the administration of a Micro Site with regard to the different fields that have been attached to it.
In the example below, the default form for a Micro Site allows you to modify and view the following elements:
- The name and email address of the Micro Site
- The status of the Micro Site
- The different fields allowing to fill in the top of the Micro Site page, its Home Page and its Footer (the use of paragraphs allows to have a great flexibility as for the content of these different elements)
- Metatag informations
- The URL of the Micro site
- The Micro Site Owner
- The Micro site's Logo and Favicon
And another form mode, called Configuration, has been created and configured (see Provide a custom form mode to Drupal 8 entities) to group other fields to configure Micro Site behavior. For example below:
- Micro Site users
- Matomo / Piwik configuration for this Micro Site
- Asset management for this Micro Site (i.e. the ability to write some specific CSS rules for this Micro Site)
The Micro Menu module has added a tab to manage the Micro Site menu entries directly from the Micro Site itself, without having to go through the standard Drupal administration menu interface.
The Micro Node module has added a Content tab to manage all the content associated with the Micro Site, in the same way as on a traditional Drupal 8 instance.
The Micro Taxonomy module has added a Taxonomy tab to manage the vocabulary dedicated to the Micro Site, but also all the taxonomy terms of the shared vocabularies associated with the Micro Site.
Finally, we have a last tab Parameters which can be used by any contributed module to add a specific configuration screen to a Micro site. For example below the possibility to create a new automatic alias pattern specific to a Micro Site.
This quick overview of the administration space of a Micro Site shows us that a user can thus administer and manage the contents of a Micro Site directly from this space, without needing an administration access to any parameter on the Drupal Master instance. At least on the essential and necessary functions of managing a Micro site.
The initial design of a Micro Site aims to allow the publication and management of countless relatively simple websites, with a dedicated management space allowing the most common website management operations to be carried out quickly. A Micro site only brings together in a single space a subset of Drupal's administration functions. And it allows us to use natively, in the context of a Micro Site, the entities provided by Drupal, with little or no alteration. We can thus benefit from all the power of Drupal to meet more advanced needs if necessary. Need a multilingual Micro Site for example? It is simply accessible without effort, simply by activating multilingualism on the Master instance.
Is Micro Site usable in production?
Most of the modules presented here are still in alpha version. There is certainly still a lot of work to be done, both in terms of consolidation of APIs, the different use cases to be tested, and correct coverage in terms of automated tests, which is essential before we can switch to beta version. And any help will certainly be welcome to get through this landing.
Personally I already use them on two different projects with very good feedback. The functional coverage of the modules of this eco-system already covers many common needs. But there are certainly use cases not yet covered that will require more or less complex integration.
Some interesting aspects of Drupal still require integration, such as block management and placement, within a Micro Site. This function can of course be managed at the Drupal Master instance level itself using the visibility parameters provided by Micro Site, but the question arises as to whether or not this administration function can be delegated within a micro site. However, the use of Paragraphs, or even the new Layout Builder, makes it possible to meet many layout needs as of now. With a relevant site building zest, some retouching on theming and templates adapted to the different site types and the choice of a content architecture based on Paragraphs, countless possibilities are already within reach without having to make major changes to other modules.
In any case, for any multi-site project considered on a Drupal 8 base, Micro Site is an additional option to be seriously considered. As an illustration, you can get a quick idea of the possibilities offered by Micro Site to build a Drupal 8 website factory which already propels some sites of different nature such as this one Freelance Drupal and others.
Great blog post! Promising module!
Thanks a lot Fabrice, for this very nice blog post.
I haven't tried the Micro Site module yet, but I'm definitely giving it a try when I have a little time.
It looks very interesting and promising.
Merci encore pour tes contributions et ton implication dans la communauté Drupal !
Super blog post! Cordialement!
Is there a way to set up multi-themed subdomains?
Is there a way to create different subdomains with different themes?
E.g. domain.com/site1 has theme1, domain.com/site2 has theme2, etc.
Yes, micro_theme allows you…
Yes, micro_theme allows you to select a different theme par micro site.
Hi. You can use the micro…
Hi. You can use the micro_theme module.
This module is what I have been waiting for. Excellent, but...
Where can I find documentation on how to set DNS, URL etc ? I am trying to setup a multisite with this module. I tried different things, but keep getting errors saying that I should check my DNS and Web server configuration.
I have it installed on a sub.mydomain1.be and want to have another mydomain2.be to be one of the micro-sites. (and later on I would do the same for mydomain3.be etc).
Thanks in advance if you could help me!
Yes, documentation is one…
Yes, documentation is one point which need to be improved. The best place to do this is in the issue queue of the module. Thanks for your feedback.
I want to combine micro site with drupal commerce , the problem is in drupal commerce products are entities and not content type.
Is it possible for each micro site to have its own products.
Yes it is possible. You will…
Yes it is possible. You will need of this (todo) : https://www.drupal.org/project/micro_site/issues/3042246
Ajouter un commentaire