Inheritance of getgrav-logo svg in Quark theme?


#1

Hi,

How come the Grav logo is not replaced by my logo, if I create an /image/ folder inside /mytheme/ folder, just like in the Quark theme?

All other files seem to be inherited correctly, but the logo stays the same. I’ve gone through other posts here, but couldn’t fully understand what’s the right solution to this.

Thanks for pointing me to the right direction.


#2

A few things I could think of:

  • Have you changed the theme in ‘system.yaml’ from ‘quark’ to ‘mytheme’?
  • Have you copied the file ‘/user/themes/quark/templates/partials/base.html.twig’ to ‘/user/themes/mytheme/templates/partials’ and changed the name of the logo file?
    <section class="navbar-section logo">
       <a href="{{ home_url }}" class="navbar-brand mr-10">{% include('@images/mytheme-logo.svg') %}</a>
    </section>
    

#3

I did not, indeed, copy the file /user/themes/quark/templates/partials/base.html.twig to /user/themes/mytheme/templates/partials and changed the name of the logo file.

I thought it was enough to have another file with the same name in the /mytheme/images folder.

Once copied that twig file and renamed the svg file, it works.

Thanks a lot!


#4

You gave me a little bit more info in your reply:

You are right… Inheritance should first look in your folders and if not found it should look in Quark’s.

The proof is in the pudding… I did the following:

  • Clean blog-skeleton which uses Quark
  • Created new inherited theme using $ bin/plugin devtools newtheme
  • Changed ‘theme’ to ‘mytheme’ in ‘system.yaml’
  • Copied /user/themes/quark/images/grav-logo.svg into /user/themes/mytheme/images/
  • Opened the copied logo and changed it to:
    <svg theme="mytheme" xmlns="http://www.w3.org/2000/svg ..."
    
  • Refreshed the browser
  • Opened devtools to look at the element
  • Guess what… The logo contains ‘theme=“mytheme”’…
  • Renamed the /user/themes/mytheme/images folder in ‘mytheme’ and Quark’s logo is shown again.

Quod erat demonstrandum… your thought was right.

Although your changes have solved the issue, I wonder if the changes solved the real underlying problem…

So I add an extra bonus question:

  • Are you sure you used the exact same name for the logo?

#5

I’m quite sure I used the exact same name for the logo. However, I’m using Quark-Open-Publishing, so we have another ingredient thrown to the mix, Quark-Open-Publishing theme, which is based on Quark…


#6

Nice extra touch… Inheritance of image is now broken indeed.


#7

Not sure what you mean… Where is it broken?


#8

I have no clue where it is broken, but your primary post is reproduce-able when I add ‘quark-open-publishing’ to the mix.

Nevertheless, you have solution at hand…