Sprint 12 Notes - LocalGov Drupal: Microsites

LocalGov Drupal Alpha 1 release

The Microsites Working Group and the project team set a target release schedule in early October which included an Alpha 1 release at the end of sprint12, Wednesday 26th October 2022. We are delighted to have stuck to this and released Alpha 1 on the planned date. 

LocalGov Drupal Microsites Alpha 1 release on Github

We are aiming to upgrade to using Group 3.x during sprints 13 and 14 and are planning for a Beta release at the end of November. From the first Beta release, we expect councils to be beta testing in the wild and will provide an upgrade path for any fundamental changes to the system. During the Alpha release phase, we are warning councils that there may not be an easy upgrade path from Alpha to Beta.

Flexing the media and text display

Layout Paragraphs allows microsite editors to add flexible content blocks into one, two or three column layouts. But sometimes we have a single paragraph that includes an image and text. One request from user testing was to be able to have greater control over the layout of the media and text paragraph. With a few extra fields, the microsite editor can now select how large they would like to display the image (or media item), a quarter of the width, a third, a half or two thirds. This is a simple solution that really does increase the flexibility of creating content that looks good and balances the image with the amount of text that is needed.

Thanks to Maria and Mark for this!

Flexible width of images and text in paragraphs

Domain Path Path Auto

Path Auto is one of those modules that I tend to take for granted. It is still the third most installed Drupal module and I recall with fondness when I first installed it (2007?) thinking it was called “pat hauto”, I assumed it was a Native American name or somesuch. For anyone not familiar, the module “automatically generates URL/path aliases for various kinds of content (nodes, taxonomy terms, users) without requiring the user to manually specify the path alias”. Often the path alias is automatically generated from the content title. One feature of pathauto is that if a piece of content has the same title as another, it creates a different unique path alias. So if /contact already exists, it will generate /contact-1.

In the microsites system, we have a single Drupal installation using Domain and Group modules to separate content for different microsites. This poses a challenge for Path Auto, it needs to be aware of the domain or group context and essentially allow duplicate aliases. We might well want /contact as a path alias on more than one microsite.

Enter https://www.drupal.org/project/domain_path module. “The Domain Path module allows the creation of separate path aliases per domain for nodes created using the Domain Access module.”.This almost worked but after a fair bit of testing needed a few patches from Drupal.org to work as intended. The end result is that microsite editors can create content and have sensible path aliases automatically generated without annoying -1 -2 strings being appended when the same path exists on other microsites.


Claro as default admin theme

On a default installation of LocalGov Drupal, we enable and select the contributed Gin theme as the admin theme. For the microsites project we have decided to default to Claro, but still include Gin as an option. Claro won due to better accessibility out of the box and is in core and stable, but only 3-2 ahead of Gin in our poll. Democratic collaboration in action!

Coloured background sections

More layout paragraphs options have been added to allow microsite editors to select different coloured backgrounds for each layout section. This can be used to present full width block colour backgrounds to break up the page, something else our test users asked for! 

Different coloured paragraph section backgrounds

Freestyle cropping

The preset crop aspect ratios proved a little restrictive for our test users. So we’ve added an unrestricted crop which allows microsite editors to create a fully freestyle crop. 

Freestyle cropping

Failing tests and open source in action.

Automated testing is great! Until something breaks all the tests! A few weeks ago we added the Media Library Edit module which provides a lovely little link to edit your media item if you want to change the alt text or alter the crop. The functionality was a great addition, but to get the tests to pass we had to explicitly tell the phpunit tests to ignore the config schema for specific configuration items. This worked for the tests within the localgov_paragraphs module where we were introducing the dependency. 

However, when we released the project, our integration tests on localgov_project repository started failing, to the tune of 49 errors. It rapidly became apparent that any configuration that had a dependency on configuration that used media_library_edit would need a similar treatment. Clearly we needed to fix this at source.

So I started this issue on 17th October (my birthday as it happens) and tried to get the correct config/schema format, with no luck. Thankfully Ekes got so annoyed with the tests he turned his brain-the-size-of-a-planet to the task and nailed it one morning last week.

Adnan tested and reviewed the issue, marking it ‘Reviewed and Tested By the Community’ (RTBC) and it has now been merged into the new 3.x branch and been released as 3.0.1

This was a small but important fix that was highlighted by our automated testing framework and was fixed collaboratively at source within a couple of weeks!

I love open source. I love my job. And I love it when people collaborate effectively on making things better.

Thanks and respect to the module maintainer Andy Hebrank too for releasing so quickly.

Back to blog