Get logo path of custom theme in page.html.twig in drupal 8 or 9

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.

/**
 * Implements hook_preprocess_page().
 */
function MYTHEME_preprocess_page(&$variables) {
  // Theme settings
  $variables['logopath'] = '/' . \Drupal::config('MYTHEME.settings')->get('logo.path');
}

Now you can use 

<img src="{{ logopath }}" />

in your page.html.twig

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!