I implemented a custom content entity with Drupal console. By default the routing is done in JobListingEntityHtmlRouteProvider.php file. I am getting a standard path such as /admin/structure/my_custom_entity/id.

I tried to use URL alias pattern to change it such as /my_custom_entity/id. That worked but still give me the admin theme upon viewing the entity. I did defined a themable custom twig template but it's not picking it up.

I also changed _admin_route to FALSE in JobListingEntityHtmlRouteProvider.php routing file. No go.

Any help appreciated.

  • Did u flush the cache after changing it to false?
    – No Sssweat
    Oct 30, 2019 at 19:55
  • Yes I did. No change. Yet I don't see explicitly a entity "view" route for my entity defined. Could that be the issue?
    – aspy
    Oct 30, 2019 at 20:06
  • Unlikely, can the route still be accessed via /admin/structure/my_custom_entity/id ?
    – No Sssweat
    Oct 30, 2019 at 20:14
  • Yes, they can still be accessed that way.
    – aspy
    Oct 30, 2019 at 20:24
  • 1
    Don't use an alias, change the canonical path directly in the entity annotations, which probably now looks like: "canonical" = "/admin/structure/my_custom_entity/{my_custom_entity}"
    – 4uk4
    Oct 31, 2019 at 10:47

1 Answer 1


As 4k4 said in the comments, the route is being generated using the link template in the entity annotations. Changing these link templates should be how you set the path to any custom entity page. For future content entities, drupal console will use the base path specified in this step: Enter the base-path for the content entity routes [/admin/structure]

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.