While making my new teme with twig I realize tat is ignoring all te proprieties I added in block--system-branding-block.html.twig to the logo img and rendering it from stable/templates/image.html.twig

My custom code is very simple, just adding a class to the img to modify it using css:

{% block content %}
  {% if site_logo %}
    <a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home" >
      <img src="{{ site_logo }}" alt="{{ 'Home'|t }}" class="site-logo"/>
    </a>
  {% else %}
    <div class="site-name">
      <h1 id="site-name">
        <a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">{{ site_name }}</a>
      </h1>
    </div>
  {% endif %}
  {% if site_slogan %}
    <div class="site-slogan">{{ site_slogan }}</div>
  {% endif %}
{% endblock %}

So I should get for logo:

   <a href="<front>" title="Home" rel="home" >
      <img src="mylogo.svg" alt="Home" class="site-logo"/>
    </a>

And getting instead:

<img src="logo.svg" alt="Inicio" typeof="foaf:Image">

As yo see, no link, no custom class, on theme debug show:
BEGIN OUTPUT from 'core/themes/stable/templates/field/image.html.twig'
just over the logo img and its ends just after, should not read the image.htl.twig and use the block--system-branding-block.html.twig file only for the branding section

Also is ignoring the if and rendering the site-name without any style

Comments

huma2000 created an issue. See original summary.

huma2000’s picture

Issue summary: View changes
huma2000’s picture

Issue summary: View changes
joelpittet’s picture

Issue tags: +Twig

Tagging.

Is it picking up your branding block file at all? Could you post the path that twig debug outputs?

huma2000’s picture

Here is the printout of twig debug:

  <div>
    

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'block' -->
<!-- FILE NAME SUGGESTIONS:
   * block--alteamorgan-branding.html.twig
   x block--system-branding-block.html.twig
   * block--system.html.twig
   * block.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/alteamorgan/templates/block--system-branding-block.html.twig' -->


<section id="block-alteamorgan-branding" class="contextual-region block-alteamorgan-branding block block-system block-system-branding-block">
  
  
    <div data-contextual-id="block:block=alteamorgan_branding:langcode=es"></div>

    <div >
    
    

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'image' -->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/field/image.html.twig' -->
<img src="http://192.168.224.250/adri/themes/alteamorgan/logo.svg" alt="Inicio" typeof="foaf:Image" />

<!-- END OUTPUT from 'core/themes/stable/templates/field/image.html.twig' -->

Altea MoganLa escritora favorita de Nyarlathotep

      </div>
  
  </section>

<!-- END OUTPUT from 'themes/alteamorgan/templates/block--system-branding-block.html.twig' -->

There you can see that is starting to print my template, then changes to img.html.twig from stable and then says that finish with my template, but ignoring all the markup on it and just printing plain text instead the formatted one.

joelpittet’s picture

I've got a guess. Can you post your page template. Specifically the part of the page the block he's placed into ?

joelpittet’s picture

Version: 8.0.0 » 8.0.x-dev
huma2000’s picture

Here you are (just remove the .txt from them).
I cannot always reproduce it, seems to happen randomly now, dunno why.

Cottser’s picture

Category: Bug report » Support request

(Until proven otherwise)

Jeff Burnz’s picture

Well, basically it looks like the branding vars are being printed in the page template, so is the block even enabled at all? Did you place the branding block in a region?

huma2000’s picture

block is placed in header region, is being rendered, just sometimes from the wrong template.
Sees not to happen now I reinstalled d8 from scratch and copy te theme over... maybe was something wrong on my installation? Was an updated install since the first rc

Jeff Burnz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.