This error occurs when installing a drupal 9 installation. Drupal requires you to provide a folder to put in your configuration yml files. Add the following to your settings.php file:

$settings["config_sync_directory"] = '../config';

This fixes the issue.

Make sure the folder exists!

An important clean-up task on bigger websites is to remove unused accounts. This snippet does the work.
Simple command to get the current drupal version
I hosted a hobby site on an aws lightsail instance but it went down almost every day. It took me long to find the issue. Here's how I solved it.
I like drupal console a lot as a helper tool for development. In this snippet I wanted to get the route of a views page. The page is on /news-events.
Personally I do not like giving block access to website editors. In this one case, there was a need to edit custom blocks. I granted access to administer blocks, but I blocked access to the overview page with this EventSubscriber.
Getting the current user role in code is quite easy, here's the snippet.
Patching workflow in drupal is something you need to learn a bit. I stumbled on a few cases where I would have to update one module only and want to prevent from updating the entire system. Here's the snippet
Loggin is very important. These snippets need to be used, be as precise as possible.
How do we correctly patch our core and modules in drupal?
Preprocessing on paragraphs is not used very often. But when needed, here is a snippet that gets you the correct type to add some preprocessing.
There are two ways of adding body classes. The first is to add them in twig, the second is to provide additional classes in mytheme.theme.
Snippet to dynamically add the year to your page.html.twig file.
This snippet sums op the possibilities of getting the current url path alias.
HubSpot is a marketing automation tool that offers forms to embed on your website. Here's how to disable the css that comes with it.
Full snippet of a working responsive header in Tailwind css
Snipet to make container larger or smaller on certain breakpoints
This is quite an easy one. I want to know in my node.html.twig file if i'm on the homepage of the site. This snippet does the trick.
The site logo moved to a block in drupal 8 but with this snippet you are still able to get the custom logo path, as defined in your settings file.
Metatags can be hard when abandoning the body field in favor of paragraphs. This post gives you a generic solution for the problem.
Most websites abandon the body field in favor of paragraphs. One flaw this has, is that no longer a summary is provided for your (auto-generated) meta description. This snippet fixes this issue.
There are use cases where you do not want drupal to send any mails at all. Here's a snippet that does the trick.
Often we create a custom settings form with stuff like social media url's or addresses. With this snippet you make the variables available in your page.twig.html file.
In the early days of Drupal 8 we used the EntityTypeManager to render some plugin blocks or other entities. But this changed a bit. Here's a snippet on how to render a block inside your twig files.
Image url is a must-have for webpages to be properly shareable on social media. With this token snippet you can set a media entity url with image style token.
A common case when using facet searches is where you want to list some terms and when people click on them you get redirected to a filtered view. This code helps you with that.
Entity references are widely used in drupal to link to other entity objects. Here's how to loop over them in a twig file.

There are some ways to make sure your loaded object is in fact an entity of type node. I prefer the following way. In addition I check if the entity types are correct too.

I had to output my dates in dutch format, but struggled a bit to do it automatically. I discovered a nice twig built-in feature.
I found a nice way to build complex menu's with twig in Html. Here are a few snippets
With this views-view.html.twig file in your theme, you add the machine name of the view to your container class.
Custom entities provide great control and flexibility because your entire entity resides in code. This snippet shows how to add a field to your entity, with an update hook. Because once the entity is installed, you should be able to add/remove/edit your fields.
I had a case where an extra tab was necessary on the user pages. This snippets show you how to do it.
Sometimes it is needed for a user to be redirected after registration. The user is not logged in yet, and has to go to a landing page with more instructions on verifying his e-mail.
By default drupal will take 600 characters to show your description. But you need to know that this setting is used to show in the metatags as well.
foreach (\Drupal::routeMatch()->getParameters() as $entity) {
  if ($entity instanceof \Drupal\Core\Entity\EntityInterface) {
    // here $entity is your object
  }
}

 

The forum module is a core module that was rewritten for drupal 8. In this snippet I show you how to create forum topics programmatically.
Drupal's default caching mechanism is to clear "all" cache. This is rather inefficiënt. There are options to clear specific caches only, here's how.
This example might help you setting up default installations.
I was building a website with Tailwind and thought it would be nice to share this generic footer html with you.
The routing system that drupal 8 offers is flexible in terms of validation. It is possible to validate your route against some typical regex lines.
Caching in drupal 8 is quite nifty, here's a snippet on how to completely disable caching in your controller.
Ik ben onlangs beginnen experimenteren met Tailwind CSS en dit nieuwe framework biedt een hoop mogelijkheden. In twee filmpjes geef ik een introductie.
Sometime you would want to require a module or library from Github instead some packagist or drupal.org. Here's how you would do this.
In this video I discuss block caching in drupal 8 & 9. It is quite radically different from drupal 7. I discuss cache tags, cache context and cache max-age.
A few months ago I released a module that provides an out-of-the-box solution for lazy loading of images in drupal 8.
What if you have to link to a specific url in in twig, but you only have the nid? Moreover, it is good practice to use the id and not a hardcored url. Here's what you should use: