I'm attempting to edit the search page. I've edited container.html.twig to contain

  set classes = [
    has_parent ? 'js-form-wrapper',
    has_parent ? 'form-wrapper',
<h2>Search Results</h2>
<div{{ attributes.addClass(classes) }}>{{ children }}</div>

It works fine when I leave the file name as container.html.twig. But I'd like for it to only apply to the search page. I've tried naming it container--search-results.html.twig but that did not work.

How do I rename container.twig.html to only apply to my search page?


Am not sure if this contains the answer, but you should definitely read this:

Twig Debugging

  • It does not. Twig debugging is what I used to figure out that container.twig.html was being used at that point, but it did not show me how I could write a custom one specifically for that page. – Matt Jul 15 '16 at 13:33
  • ah okey! Wanted to make sure you know it! Further investigation is needed! – ssibal Jul 15 '16 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.