Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Quark OP - cannot use custom logo.svg using child theme

Started by Joel Marks 2 years ago · 5 replies · 135 views
2 years ago

Hi everyone. Hoping for help...

My goal is to have a custom svg logo, with changes made only to mytheme, and for it to colour invert on scroll, just like the default Grav logo.

Setup: Fresh download of Grav and Quark Open Publishing. Running locally on Linux.

Attempted so far: Changing mytheme.yaml
Using this instruction here: Quark: Using SVG as custom logo ...I have been unable to change from default grav logo located in quark/images/grav-logo.svg

This appears to be because the first "if" statement fails and only the "elseif" statement is read. I can tell this by inserting text after the statements as they render onto the page to tell me what is happening.

Notes:

  • Working with a fresh install and skeleton of Quark OP - and am making changes to MyTheme only
  • I have a new logo.svg located in mytheme/images/logo and a copy of it in mytheme/images as well, just in case. I've also tried using the default logo, but the issue appears to be elsewhere
  • I have not set a logo in the admin backend as it just inserts an <img>
  • I tried adding a logo variable to mytheme.yaml as suggested elsewhere in forum, but it seemed to be a png specific thing and had no effect on issue

Thank you all so much

👍 1
2 years ago

Perhaps, this helps (it's in german, let google translate):

https://gravik.ch/rezepte/quark-one-page-site-farbwechsel-effekt-des-quark-svg-logos-in-einem-child-theme

and/or copy the file themes/quark/templates/partials/logo.html.twig to themes/mytheme/templates/partials/logo.html.twig and adapt the code as follows:

TWIG

{% set logo = theme_var(mobile ? 'custom_logo_mobile' : 'custom_logo') %}
<a href="{{ home_url }}" class="navbar-brand mr-10">
{% if logo %}
  {% set logo_file = (logo|first).name %}

  {% set logo_end =  (logo_file|split('.')|last) %}
    {% if logo_end == 'svg' %}
      {# Logo ist im SVG-Format - einbetten #}
      {% include('@images/logo/' ~ logo_file) %}
    {% else %}
      {# Logo ist im Bitmap-Format (PNG, JPG etc.) - mit img-Tag einbinden #}
      <img src="{{ url('theme://images/logo/' ~ logo_file)  }}" alt="{{ site.name }}" />
    {% endif %}

{% else %}
  {% include('@images/grav-logo.svg') %} 

{% endif %}
</a>```
👍 1
2 years ago

Thanks to pamtbaau I've been made aware of this issue and he kindly created a PR which I plan to review very soon. Will post an update here once that is done.

👍 1
2 years ago

Submitted PR fix from pamtbaau now merged and released in Quark Open Publishing v2.3.2. If anyone can re-test and report much appreciated.

2 years ago

Hi @paulhibbitts

Many thanks! From what I can see this is working perfectly.

Side note: My svg file, generated using Affinity Design, does not appear to allow the css colour flip. I've an older logo which was made using Adobe which works fine. There may be a file format element in this that I was also struggling with.

👍 2
2 years ago

I used this code and it worked exactly as expected. Thanks so much for showing me this

👍 2

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 82 12 hours ago
General · by pamtbaau, 17 hours ago
1 55 16 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 348 5 days ago
General · by Duc , 5 days ago
3 43 5 days ago