Skip to main content

Drupal 9: How to get your custom theme logo path

 Since drupal 8 the site logo is available as a block. This is  how you can get the custom logo path from your custom theme.

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

In your twig page.html.twig template

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

preprocess theming