I have a FAQ page with five nested bootstrap 5 accordions and I need to have one accordion item or another open depending on the page the user is coming from.

I tried using this:

{% set previousURL = app.request.headers.get('referer') %}

but I get nothing.

Using Drupal 9.

  • app is something the Symfony Twig Bundle adds to Twig templates which does not exist in Drupal. Did you discover this in a Symfony Framework tutorial?
    – cilefen
    May 11, 2022 at 16:16
  • I would solve this using javascript instead of twig. May 11, 2022 at 20:10

1 Answer 1


To do this you must either:

Your Answer

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

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