This is the code I used in Drupal 7.

            <a href="<?php print $base_path ?>" title="<?php print t('Home') ?>">
                <img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" />

This is the code I am using for Drupal 8.

           <a href="{{ base_path }}" title="{{ 'Home'|t }}">      
    <span>{{ logopath }}</span>
                <img src="{{logo}}" alt="{{ 'Home'|t }}" alt="T.M. Patel International School"/>

If I upload the logo, it doesn't display. What should I do now?


1 Answer 1


This Link might be helpful : http://www.lohmeyer.rocks/blog/2015/01/14/00187-print-your-themes-logo-path-drupal-8-twig.

I think you should define the logo path variable first into template.tpl in MyTheme_preprocess_page function.

One More thing you are trying to use {{logopath}} in 'span' tag and into 'src' its {{logo}}.

  • i tried it..its nt working...
    – Swati
    Commented May 27, 2016 at 6:41
  • There isn't any template.tpl, in Drupal 8.
    – apaderno
    Commented May 27, 2016 at 6:53
  • @kiamlaluno thanks, i thinks its Mytheme.theme file instaead of tempalte.tpl, if i am wrong kindly make a correction. Commented May 27, 2016 at 7:00
  • The main file of a theme has .theme extension, now, if you are referring to that. In Drupal 7, it was template.php, though, not template.tpl.
    – apaderno
    Commented May 27, 2016 at 7:02
  • @Swati Try debugging your variables. These links might be helpful to debug twig files drupalize.me/blog/201405/lets-debug-twig-drupal-8 and drupal.stackexchange.com/questions/98014/… Commented May 27, 2016 at 7:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.