There maybe times when you do not want certain pages of your website to look like the rest. You might want a different theme, a unique menu or a distinct layout altogether. That’s when you will want to create Micro-sites. Micro-sites are small sites that can be subsets of your main site or have a completely different domain/subdomain. Mainly used for discrete marketing campaigns, events or products, micro-site marketing is a great tool to promote focused campaigns.
With Drupal 8 (and 9) you can build micro-sites within your existing setup using the Group module. You can have a separate set of users, permissions, and pages within that setup. Let’s learn more about this amazing module and how you can create micro-sites using the Group module.
Creating micro-sites using the Group module for Drupal
The latest version of the Group module was released in Drupal 8.8 and is compatible with Drupal 9 as well. It enables you to build discrete collections of content and users on your Drupal site. You can also setup access control for these collections. Group module is not only useful to create micro-sites but can be used whenever a site needs to create content that needs to be accessed only by certain user groups.
Installing the Group Module
Follow the below steps to install the Group module for Drupal 8 (or 9).
Step 1: Use this command to install the module
composer require 'drupal/group’
Step 2: Enable the Group and Group Node module
Working with the module
Once the module is installed you will see Groups in the administrative menu.
Under Groups, you need to create a Group type for your micro-sites. Group types are basically types of divisions for your website. In our case the group-type is a Micro-site.
After adding the group type you can add fields to your micro-site. You will see 3 extra tabs in this group type - Content, Roles, Permissions.
In the same above image, you can see a content tab where you can add content types to your micro-site (these are content types that we have created in our main site).
Now, you can also create separate roles for the micro-sites.
After adding a separate role to the micro-site, you can add permissions to that particular role by clicking on Edit permissions. You can set the permissions as per your requirement.
Next, you have a permission tab where you can add permissions to anonymous users and other micro site members. After configuring your group type, you can now add the group to that particular group type.
Now while editing your group you will see many other tabs apart from View, Edit and Delete.
Now, go to the Members tab where you can add members to the group. These are the members who can perform actions on this particular group. (Note: by default, admin will be a member of the group. You can disable this functionality in the group type configuration.)
Go to the Nodes tab to add content to the group.
All entities: This lists all the nodes and users in that particular group.
Adding menus to Micro-sites
Install Group Content Menu using this command then enable the module.
composer require 'drupal/group_content_menu'
After installing this module, you will see Group Content Menu types under Structure. Create a group content menu type for your micro site.
Place this menu type in the block layout where you want to display it.
Configure the block to display in the micro site.
Now in the group type content tab you will get the Group menu. Install that to display menus in your micro-site.
Now you should be able to see group menu in your groups.
In group menu you need to create a name for the Menu set.
After adding the menu set, you can now add menus.
Now clear your cache and check the group. The menu will be displayed wherever you have placed it in your block layout.