I'm using a custom theme for our Drupal 8 based website, for breadcrumbs I'm using the easy breadcrumbs module.

We have a custom module where the nodes are generated in a custom block dynamically.

Below is the current structure in the module.routing.yml file

  path: '/subject/{node}' 
    _controller: '\Drupal\testmodule\Controller\resController::res' 
    _title: ''
    _permission: 'access content' 

In the path - /subject/{node} the node contains a subject name belonging to a group, for instance resources group subject contain - Physics, Math and Chemistry.

The node in the path /random/{node} will contain the subject name

The breadcrumb pattern will be home>>subject>>Math

But I'm unable to find a way to display the subject name as the last breadcrumb. Do let me know what can be done

  • 1
    You can use a _title_callback to generate a dynamic title for a route rather than setting to ''. This is documented in the top answer to "How do I set the page title?". I think that may resolve your issue.
    – sonfd
    Feb 3, 2021 at 17:38
  • 1
    Does this answer your question? How do I set the page title?
    – leymannx
    Feb 3, 2021 at 18:54
  • @sonfd, the solution is very confusing to me as I'm a beginner into Drupal development, for _title_callback should I include the the php code in the routing file?I need to set page title for each subject name
    – Jake13
    Feb 4, 2021 at 5:23


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.

Browse other questions tagged or ask your own question.