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?
    – mona lisa
    Commented May 11, 2022 at 16:16
  • I would solve this using javascript instead of twig. Commented 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 you have read our privacy policy.

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