This is the first article from the series of content on Drupal development best practices. We will start with site-building.
Any developer who has been working in web for a long time has come across sites with one or several following problems:
- SEO - search engines don’t display your site at the top positions
- Security - special tools often show that your site has been infected with malicious code
- Maintenance - it takes a lot of time to add new features, fix old bugs, etc
- Performance - sites are very slow and many users leave it without waiting until the page loads.
It happens because your site was built without using proven methods (aka the best practices). This article will show your problems and how to solve them. We deliberately didn’t make separate lists for each problem mentioned since one module sometimes solves a few problems.
List of not recommended Drupal modules
This is a list of modules that you have to disable on a live website. They are not bad, you just must use them only on the dev environment.
- Devel - it can help you debug problems in Twig templates or generate dummy content, but all these features are needed only for developing websites.
- UI submodules - all submodules like Views UI, Field UI, etc. should be disabled. You need to use them on a dev instance and then migrate necessary configurations.
In most cases, you will not need these modules, too:
The main goal of these lists is to try to avoid too many modules. Too many enabled modules can slow down your site. Additionally, modules that are poorly maintained and contain bugs can be detrimental to the security and stability of your site.
List of recommended Drupal modules
We strongly advise using the following modules. Having them installed, you will be able to solve many of your problems.
- Update manager - it’s a very helpful module that can inform you about any security updates for your modules and the Drupal core.
- Advanced CSS/JS Aggregation - improves the front-end performance of your site.
- Backup and migrate - keeps copies of your site in case of serious problems with it.
- Elysia Cron - extends Drupal standard cron, allowing a fine-grain control over each task.
- Redirect - allows a site administrator to add 301 redirects for old page URLs.
- Rabbit Hole - hides unpublic nodes.
- Security Kit - reduces the risks of exploitation of different web application vulnerabilities.
Make Drupal more friendly for editors
Drupal 8 provides inline editing and working preview. Also, it moved the “advanced” options to the right sidebar. The admin pages became more clear, but editor experience is not ideal yet. It depends on you whether it will be easy to work with a site or not.
- You should use as many content types as reasonable. If you create a lot of content types, maintaining your website will also take much time.
- Display only needed settings. You have permission to configure what editors will see. Do not make them deal with a lot of unnecessary settings.
- Editors must have the ability to edit content and layouts. It means that content should never be stored in code. Also, there are a lot of modules to build layouts (Panels, Display Suite, Paragraphs, Layout Suite, etc). Just use them and give permissions for editors to update layouts too.
- Simple site navigation is needed not only by users but for your editors too. Contextual links, breadcrumbs, admin menu - this is not a complete list of what will facilitate their work.
- Try to remember an important rule: only nodes should store content, not taxonomy nor entities. They were created for other purposes (i.e. for categorizing contents).
- Let your developers using HTML tags. Editors should work with content. That’s why you need to install CKEditor.
- Working with images and other kinds of media must be also clear. You can use Entity Browser, Entity Embed modules (just look at this great documentation).
- SEO - we have already written about this. Please have a look at our article Drupal and SEO.
- Distributions - using the ready-made solutions saves your time (try to find a similar project here before creating a new website)
- Drupal theming best practices
All these practices are based on many years of experience of many developers. Just follow them and you can save your time and avoid common mistakes. Hope it will help!