So I have 2 themes. The main custom theme we are using and bootstrap as a secondary theme that supports it.

However, there are some things that appear on the page that are only there because of bootstraps twig templates. Is there a way I can override these with my custom templates without editing bootstraps twig templates?

Here is a example:

{% if title %}
  <h1{{ title_attributes.addClass('page-header') }}>{{ title }}</h1>
{% endif %}

This is bootstraps page title and I would like to remove it without editing bootstraps twig templates. Is there a way I can overwride this with my templates? I already made a custom page twig template, but it adds bootstraps as well.

  • I don't understand - you override the twig template and it still what, adds that class? Adds attributes?
    – Kevin
    Commented Dec 5, 2020 at 18:21
  • I want to remove the title completely, but I can't edit bootstrap templates as I would like to leave them be. But it only gets generated via bootstrap and not my custom theme template.
    – Shawn
    Commented Dec 5, 2020 at 18:23
  • Copy that template file to your theme's /templates folder. Remove that line, flush all caches.
    – No Sssweat
    Commented Dec 5, 2020 at 18:48


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.