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

Latest Articles

VSCode Drupal Coding Standards Setup (From Scratch) admin_pixelthi… Mon, 12/22/2025 - 16:01 VSCode Drupal Coding Standards Setup (From Scratch)

VSCode Drupal Coding Standards Setup (From Scratch)

vscode
Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file admin_pixelthi… Sun, 12/01/2024 - 16:49 Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file

Using drupal/core-composer-scaffold to prevent rewriting .htaccess or robots.txt file

composer