0
votes

I am new to Drupal, and I'm creating a custom theme based on a Bootstrap Bario subtheme on Drupal 8. I can update the CSS with no problem, but I first need to clear the cache before reloading the page (which gets annoying, is there a way to avoid that?).

This is how the theme's regions are arranged:

Regions Layout

I added the help: 'Help' region in the .info.yml file, under the line footer_fifth: 'Footer Fifth', and the added Help region appears in the Block Layout page.

I then modified the relevant parts of templates/_page.html.twig like so: From this

{% block footer %}
<div class="{{ container }}">
  {% if page.footer_first or page.footer_second or page.footer_third or page.footer_fourth %}
    <div class="site-footer__top clearfix">
      {{ page.footer_first }}
      {{ page.footer_second }}
      {{ page.footer_third }}
      {{ page.footer_fourth }}
    </div>
  {% endif %}
  {% if page.footer_fifth %}
    <div class="site-footer__bottom">
      {{ page.footer_fifth }}
    </div>
  {% endif %}
</div>
{% endblock %}

to this

{% block footer %}
<div class="{{ container }}">
  {% if page.footer_first or page.footer_second or page.footer_third or page.footer_fourth or page.footer_fifth %}
    <div class="site-footer__top clearfix">
      {{ page.footer_first }}
      {{ page.footer_second }}
      {{ page.footer_third }}
      {{ page.footer_fourth }}
      {{ page.footer_fifth }}
    </div>
  {% endif %}
  {% if page.help %}
    <div class="site-footer__bottom">
      {{ page.help }}
    </div>
  {% endif %}
</div>
{% endblock %}

As you can see, I added or page.footer_fifth to the first if statement, moved {{ page.footer_fifth }} to the site-footer__top div, and added {{ page.help }} in its place.

After that, I go and clear the cache, but the block regions are still the same. If I inspect my block in the Footer Fifth region, it is still in the <div class="site-footer__bottom">. Did I miss something?

Thank you in advance.

1

1 Answers

1
votes

I think the template file name is wrong. See:

templates/_page.html.twig usually should be:

templates/page.html.twig

the complete path of your template should be "/themes/custom/yourthemename/".

PS: theme debug will help you in case of any doubt.

https://www.drupal.org/docs/theming-drupal/twig-in-drupal/debugging-twig-templates