What we learned by building our new company site in Drupal 8
Last week, we launched our new company site built in Drupal 8. Previously, it was a Drupal 6 site built ages ago and in high need of a redesign anyway. So, with Drupal 8 around the corner, what better way to learn Drupal 8 and help development at the same time?
We started exploring around the time of the first beta, and decided to write up all the bumps in the road we encountered along the way. Overall, it was a great experience and we even managed to squeeze in a patch or two to fix some bugs. Drupal 8 clearly has a lot of improvements for everybody: developers will enjoy the solid framework, frontend people get Twig, and I can't wait to show clients the quick edit functionality.
General tips and notes:
- The site does not use any contrib modules. Most of the common ones we use are now in core. We did use the Devel module during development.
- We did built some custom modules, mostly for some custom blocks. More on those below.
- We usually use Display Suite, but with the new powers from the Twig templating system, we didn't miss it.
- Drupal 8 is installed with production settings by default. So make sure you have debugging enabled in your development environment by using the example.settings.local.php file located in sites/default.
- Getting a WSOD or fatal error? First try running update.php, rebuild.php, and/or manually clearing the cache tables and remove the php directory in the files folder (rebuild.php does this for you).
- Upgrade to Drush 7 or else drush won't work in Drupal 8.
- Enable Twig debugging by using development.services.yml (see services.yml for examples).
- The Devel module also has a new debugging tool called Kint.
- If all that doesn't help, try this core patch which will give you a lot more detailed debug information on fatal errors.
- Minor thingy: Google webmaster warns about robots.txt having invalid syntax.
Chasing Drupal 8 betas:
- There is no beta-to-beta upgrade path (not yet, but it's close). Because of this I felt chasing head was the better choice. That way you can easier track down changes that might break your site or need database updates.
- Speaking of changes, keep a close eye on the Drupal 8 changelog, everything is documented there with references to issues.
- For example: the latest beta6 release requires you to have the link module enabled, because shortcut depends on it. If you upgrade to beta6 or higher from a previous copy and do not have the link module enabled you will get a fatal error.
- The site we built is in Dutch, but we wanted to have it "multilingual ready" (e.g. have the language prefix) so we used the multilingual modules which are in core.
- Upgrading was difficult due to database update issues which seem to be fixed now.
- Drupal was never as multilingual as Drupal 8 is, but expect bugs as this is still under heavy development.
- Gabor has written a great series of posts about multilingual Drupal 8 tidbits. Highly recommended because it also touches some core concepts in Drupal 8 like content and configuration entities.
Custom modules we built:
- This router also generates some custom meta tags for our frontpage.
- We also made some programatically created blocks. These are used for the testimonials flexslider to load some custom blocks using entityQuery and entity_load_multiple. Super easy! (at the time, this was not yet possible with views, but seems to be fixed now)
Concluding: we are very excited about Drupal 8 and I can highly recommend building your own company site in D8 at this time, although I wouldn't use it for most client work just yet.
You can find similar blog posts with even more very useful information below. They certainly were useful for us, so thanks!